Skip to content

Commit dfe1f78

Browse files
Guard Image Type Icon from Smooth Scaling
Enabling the smooth scaling for icon produce erroneous result. Resulting in icon losing its transparency.
1 parent 940240a commit dfe1f78

File tree

1 file changed

+4
-0
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal

1 file changed

+4
-0
lines changed

bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ private static ImageData autoScaleImageData (Device device, final ImageData imag
294294
int scaledHeight = Math.round (height * scaleFactor);
295295
return switch (autoScaleMethod) {
296296
case SMOOTH -> {
297+
if (imageData.maskPad == SWT.TRANSPARENCY_MASK) {
298+
yield imageData.scaledTo(scaledWidth, scaledHeight);
299+
}
300+
297301
Image original = new Image (device, (ImageDataProvider) zoom -> imageData);
298302
/* Create a 24 bit image data with alpha channel */
299303
final ImageData resultData = new ImageData (scaledWidth, scaledHeight, 24, new PaletteData (0xFF, 0xFF00, 0xFF0000));

0 commit comments

Comments
 (0)