Skip to content

Commit e9b2d84

Browse files
Eclipse Releng Botjonathan-meier
authored andcommitted
Issue #301 - [win32]: only allow alpha data in ImageData.data for icons
Fixes the regression introduced in PR #224 (commit 8def011) which also allowed alpha data in ImageData.data for bitmaps. Alpha data for bitmaps must be provided in ImageData.alphaData. This ensures proper conversion of the image data to pre-multiplied alpha format and aligns the behavior of Image initialization with the implementation for Linux.
1 parent 11d0330 commit e9b2d84

File tree

1 file changed

+5
-1
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics

1 file changed

+5
-1
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1862,7 +1862,11 @@ static ImageData directToDirect(ImageData src, int newDepth, PaletteData newPale
18621862
}
18631863
break;
18641864
case 32:
1865-
if (!(redMask == 0xFF00 && greenMask == 0xFF0000 && blueMask == 0xFF000000)) {
1865+
if (i.getTransparencyType() != SWT.TRANSPARENCY_MASK) {
1866+
newDepth = 24;
1867+
newPalette = new PaletteData(0xFF, 0xFF00, 0xFF0000);
1868+
}
1869+
else if (!(redMask == 0xFF00 && greenMask == 0xFF0000 && blueMask == 0xFF000000)) {
18661870
newPalette = new PaletteData(0xFF00, 0xFF0000, 0xFF000000);
18671871
}
18681872
break;

0 commit comments

Comments
 (0)