Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 99253
Collapse All | Expand All

(-)Eclipse SWT/common/org/eclipse/swt/internal/image/WinICOFileFormat.java (-1 / +17 lines)
Lines 138-144 Link Here
138
	byte[] maskData = bmpFormat.loadData(infoHeader);
138
	byte[] maskData = bmpFormat.loadData(infoHeader);
139
	maskData = convertPad(maskData, width, height, 1, 4, 2);
139
	maskData = convertPad(maskData, width, height, 1, 4, 2);
140
	bitInvertData(maskData, 0, maskData.length);
140
	bitInvertData(maskData, 0, maskData.length);
141
	return ImageData.internal_new(
141
	ImageData data = ImageData.internal_new(
142
		width,
142
		width,
143
		height,
143
		height,
144
		depth,
144
		depth,
Lines 155-160 Link Here
155
		0,
155
		0,
156
		0,
156
		0,
157
		0);
157
		0);
158
	if (depth == 32) {
159
		/*
160
		 * Looking at various header information, only icons with 
161
		 * 32-bit depth can contain alpha channel. So, constructing
162
		 * alphaData bytes accordingly into imageData object.
163
		 */
164
		int stride = (width * depth + 7) / 8;
165
		byte[] alphaData = new byte[width * height];
166
		for (int y = 0; y < height; y++) {
167
			for (int x = 0; x < width; x++) {
168
				alphaData[y*width+x] = shapeData[y*stride+x*4 + 3];
169
			}
170
		}
171
		data.alphaData = alphaData;
172
	}
173
	return data;
158
}
174
}
159
int[][] loadIconHeaders(int numIcons) {
175
int[][] loadIconHeaders(int numIcons) {
160
	int[][] headers = new int[numIcons][7];
176
	int[][] headers = new int[numIcons][7];
(-)Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java (-5 / +8 lines)
Lines 1005-1010 Link Here
1005
	OS.g_object_unref(pixbuf);
1005
	OS.g_object_unref(pixbuf);
1006
	
1006
	
1007
	boolean isIcon = image.getTransparencyType() == SWT.TRANSPARENCY_MASK;
1007
	boolean isIcon = image.getTransparencyType() == SWT.TRANSPARENCY_MASK;
1008
	boolean hasAlpha = false;
1008
	if (isIcon || image.transparentPixel != -1) {
1009
	if (isIcon || image.transparentPixel != -1) {
1009
		if (image.transparentPixel != -1) {
1010
		if (image.transparentPixel != -1) {
1010
			RGB rgb = null;
1011
			RGB rgb = null;
Lines 1031-1042 Link Here
1031
		this.type = SWT.BITMAP;
1032
		this.type = SWT.BITMAP;
1032
		this.mask = 0;
1033
		this.mask = 0;
1033
		this.alpha = image.alpha;
1034
		this.alpha = image.alpha;
1034
		if (image.alpha == -1 && image.alphaData != null) {
1035
		hasAlpha = true;
1035
			this.alphaData = new byte[image.alphaData.length];
1036
	}
1036
			System.arraycopy(image.alphaData, 0, this.alphaData, 0, alphaData.length);
1037
	if (image.alpha == -1 && image.alphaData != null) {
1037
		}
1038
		this.alphaData = new byte[image.alphaData.length];
1038
		createAlphaMask(width, height);
1039
		System.arraycopy(image.alphaData, 0, this.alphaData, 0, alphaData.length);
1040
		hasAlpha = true;
1039
	}
1041
	}
1042
	if (hasAlpha) createAlphaMask(width, height);
1040
	this.pixmap = pixmap;
1043
	this.pixmap = pixmap;
1041
}
1044
}
1042
1045

Return to bug 99253