ImageData readImageBlock(int defaultDepth, PaletteData defaultPalette) {
ImageData readImageBlock(PaletteData defaultPalette) {
	ImageData readImageBlock(int defaultDepth, PaletteData defaultPalette) {		int depth;		PaletteData palette;		byte[] block = new byte[9];		try {			inputStream.read(block);		} catch (IOException e) {			SWT.error(SWT.ERROR_IO, e);		}		int left = (block[0] & 0xFF) | ((block[1] & 0xFF) << 8);		int top = (block[2] & 0xFF) | ((block[3] & 0xFF) << 8);		int width = (block[4] & 0xFF) | ((block[5] & 0xFF) << 8);		int height = (block[6] & 0xFF) | ((block[7] & 0xFF) << 8);		byte bitField = block[8];		boolean interlaced = (bitField & 0x40) != 0;		boolean sorted = (bitField & 0x20) != 0;		if ((bitField & 0x80) != 0) {			// Local palette.			depth = (bitField & 0x7) + 1;			palette = readPalette(1 << depth);		} else {			// No local palette.			depth = defaultDepth;			palette = defaultPalette;		}		// Promote depth to next highest supported value.		if (!(depth == 1 || depth == 4 || depth == 8)) {			if (depth < 4)				depth = 4;			else				depth = 8;		}		if (palette == null) {			palette = grayRamp(1 << depth);		}		int initialCodeSize = -1;		try {			initialCodeSize = inputStream.read();		} catch (IOException e) {			SWT.error(SWT.ERROR_IO, e);		}		if (initialCodeSize < 0) {			SWT.error(SWT.ERROR_INVALID_IMAGE);		}		ImageData image = ImageData.internal_new(			width,			height,			depth,			palette,			4,			null,			0,			null,			null,			-1,			transparentPixel,			SWT.IMAGE_GIF,			left,			top,			disposalMethod,			delayTime);			LZWCodec codec = new LZWCodec();		codec.decode(inputStream, loader, image, interlaced, initialCodeSize);		return image;	}