int depth = (bitField & 0x7) + 1;
defaultDepth = (bitField & 0x7) + 1;
	ImageData[] loadFromByteStream() {		byte[] signatureBytes = new byte[3];		byte[] versionBytes = new byte[3];		byte[] block = new byte[7];		try {			inputStream.read(signatureBytes);			signature = new String(signatureBytes);			if (!signature.equals("GIF"))				SWT.error(SWT.ERROR_INVALID_IMAGE);			inputStream.read(versionBytes);			version = new String(versionBytes);			inputStream.read(block);		} catch (IOException e) {			SWT.error(SWT.ERROR_IO, e);		}		screenWidth = (block[0] & 0xFF) | ((block[1] & 0xFF) << 8);		loader.logicalScreenWidth = screenWidth;		screenHeight = (block[2] & 0xFF) | ((block[3] & 0xFF) << 8);		loader.logicalScreenHeight = screenHeight;		byte bitField = block[4];		backgroundPixel = block[5] & 0xFF;		aspect = block[6] & 0xFF;		bitsPerPixel = ((bitField >> 4) & 0x07) + 1;		int depth = (bitField & 0x7) + 1;		PaletteData palette = null;		if ((bitField & 0x80) != 0) {			// Global palette.			sorted = (bitField & 0x8) != 0;			palette = readPalette(1 << depth);		} else {			// No global palette.			sorted = false;			backgroundPixel = -1;			depth = bitsPerPixel;		}		loader.backgroundPixel = backgroundPixel;		getExtensions();		int id = readID();		ImageData[] images = new ImageData[0];		while (id == GIF_IMAGE_BLOCK_ID) {			ImageData image = readImageBlock(depth, palette);			if (loader.hasListeners()) {				loader.notifyListeners(new ImageLoaderEvent(loader, image, 3, true));			}			ImageData[] oldImages = images;			images = new ImageData[oldImages.length + 1];			System.arraycopy(oldImages, 0, images, 0, oldImages.length);			images[images.length - 1] = image;			try {				/* Read the 0-byte terminator at the end of the image. */				id = inputStream.read();				if (id > 0) {					/* We read the terminator earlier. */					inputStream.unread(new byte[] {(byte)id});				}			} catch (IOException e) {				SWT.error(SWT.ERROR_IO, e);			}			getExtensions();			id = readID();		}		return images;	}