Revision 4974 trunk/libraries/libCq CMS for java.old/src/org/cresques/io/MrSidFile.java

View differences:

MrSidFile.java
305 305
     * @throws MrSIDException Lanzada si ocurre un error en la lectura de la escena
306 306
     */
307 307
    public void readScene(int[] line) throws MrSIDException {
308
        int x = (int) currentViewX;
309
        int y = (int) currentViewY;
308
        int x = (int) Math.ceil(currentViewX);
309
        int y = (int) Math.ceil(currentViewY);
310 310
        int SceneWidth;
311 311
        int SceneHeight;
312 312

  
......
315 315
                SceneWidth = currentFullWidth;
316 316
                SceneHeight = currentFullHeight;
317 317
            } else {
318
				SceneWidth = (int) Math.round((((double) currentViewWidth) / viewportScale) + 1);
318
				SceneWidth = (int) Math.ceil((((double) currentViewWidth) / viewportScale) + 1);
319 319
				if (SceneWidth > currentFullWidth)
320 320
					SceneWidth = currentFullWidth;
321
				SceneHeight = (int) Math.round((((double) currentViewHeight) / viewportScale) + 1);
321
				SceneHeight = (int) Math.ceil((((double) currentViewHeight) / viewportScale) + 1);
322 322
		        if (SceneHeight > currentFullHeight)
323 323
		        	SceneHeight = currentFullHeight;
324 324
            }
......
339 339
			
340 340
            boolean  hecho = false;
341 341
			while (!hecho){
342
				LTIScene scene = new LTIScene(x, y, SceneWidth, SceneHeight,
343
						zoomoverview);
342
				LTIScene scene = new LTIScene(x, y, SceneWidth, SceneHeight, zoomoverview);
344 343

  
345 344
				// Este deber?a ser el constructor con ventana
346
				buffer = new LTISceneBuffer(pixel, SceneWidth,
347
						SceneHeight, true);
345
				buffer = new LTISceneBuffer(pixel, SceneWidth, SceneHeight, true);
348 346

  
349 347
				hecho = true;
350 348
				try {
......
392 390
                    bandB = buffer.buf3;
393 391
                }
394 392
                
393
                //Desplazamiento para la X y la Y leidas. Estas tienen efecto cuando un pixel no empieza a visualizarse
394
                //justo en su esquina superior izquierda y tiene que ser cortado en la visualizaci?n.
395
                double offsetX = Math.abs(currentViewX - ((int)currentViewX));
396
                double offsetY = Math.abs(currentViewY - ((int)currentViewY));
395 397
                for (int y1 = 0; y1 < currentViewHeight; y1++)
396 398
                   for (int x1 = 0; x1 < currentViewWidth; x1++) {
397 399
                      kd = (y1 * currentViewWidth) + x1;
398
                      k = (((int) (y1 * scale)) * SceneWidth) +
399
                          (int) (((double) x1) * scale);
400
                      k = (((int) ((y1 * scale) + offsetY)) * SceneWidth) + 
401
                      		(int) ((x1 * scale) + offsetX);
400 402

  
401 403
                      try {
402 404
                            line[kd] = alpha + ((0xff & bandR[k]) << 16) +

Also available in: Unified diff