Revision 26071 trunk/libraries/libRaster/src/org/gvsig/raster/dataset/io/MrSidDriver.java

View differences:

MrSidDriver.java
303 303
		try {
304 304
			file.readScene(pRGBArray, task);
305 305
			int w = rasterBuf.getWidth();
306
			for (int row = 0; row < rasterBuf.getHeight(); row++) {
307
				for (int col = 0; col < w; col++) {
308
					rasterBuf.setElem(row, col, 0, (byte) ((pRGBArray[(row * w) + col] & 0x00ff0000) >> 16));
309
					rasterBuf.setElem(row, col, 1, (byte) ((pRGBArray[(row * w) + col] & 0x0000ff00) >> 8));
310
					rasterBuf.setElem(row, col, 2, (byte) (pRGBArray[(row * w) + col] & 0x000000ff));
306
			if(getBandCount() >= 3) {
307
				for (int row = 0; row < rasterBuf.getHeight(); row++) {
308
					for (int col = 0; col < w; col++) {
309
						rasterBuf.setElem(row, col, 0, (byte) ((pRGBArray[(row * w) + col] & 0x00ff0000) >> 16));
310
						rasterBuf.setElem(row, col, 1, (byte) ((pRGBArray[(row * w) + col] & 0x0000ff00) >> 8));
311
						rasterBuf.setElem(row, col, 2, (byte) (pRGBArray[(row * w) + col] & 0x000000ff));
312
					}
313
					if (task.getEvent() != null)
314
						task.manageEvent(task.getEvent());
311 315
				}
312
				if (task.getEvent() != null)
313
					task.manageEvent(task.getEvent());
314 316
			}
317
			if(getBandCount() == 1) {
318
				for (int row = 0; row < rasterBuf.getHeight(); row++) {
319
					for (int col = 0; col < w; col++) 
320
						rasterBuf.setElem(row, col, 0, (byte) (pRGBArray[(row * w) + col] & 0x000000ff));
321
					if (task.getEvent() != null)
322
						task.manageEvent(task.getEvent());
323
				}
324
			}
315 325
		} catch (MrSIDException e) {
316 326
			throw new RasterDriverException("Error reading data");
317 327
		}

Also available in: Unified diff