Skip to content

Commit 4a6ab2a

Browse files
ShahzaibIbrahimakoch-yatta
authored andcommitted
Remove ImageHandle(long, int) to initialize transparentPixel from client
Diverting responsibility for thinking about whether a transparentPixel needs to be specified or not to the consumer. Otherwise we risk that someone unexperienced just calls this constructor without thinking about the transparent pixel, but would actually need to take into account that it must be set.
1 parent f27bbb6 commit 4a6ab2a

File tree

1 file changed

+4
-8
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics

1 file changed

+4
-8
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,7 @@ private ImageHandle initIconHandle(long[] handles, int zoom) {
16501650
OS.DeleteObject(handles[0]);
16511651
OS.DeleteObject(handles[1]);
16521652
type = SWT.ICON;
1653-
return new ImageHandle(hIcon, zoom);
1653+
return new ImageHandle(hIcon, zoom, -1);
16541654
}
16551655

16561656
private ImageHandle initBitmapHandle(ImageData imageData, long handle, Integer zoom) {
@@ -2040,7 +2040,7 @@ private class ExistingImageHandleProviderWrapper extends AbstractImageProviderWr
20402040
public ExistingImageHandleProviderWrapper(long handle, int zoomForHandle) {
20412041
this.handle = handle;
20422042
this.zoomForHandle = zoomForHandle;
2043-
ImageHandle imageHandle = new ImageHandle(handle, zoomForHandle);
2043+
ImageHandle imageHandle = new ImageHandle(handle, zoomForHandle, -1);
20442044

20452045
ImageData baseData = imageHandle.getImageData();
20462046
this.width = DPIUtil.pixelToPoint(baseData.width, zoomForHandle);
@@ -2298,7 +2298,7 @@ private ImageHandle createBaseHandle(int zoom) {
22982298

22992299
private ImageHandle createHandle(int zoom) {
23002300
long handle = initHandle(zoom);
2301-
ImageHandle imageHandle = new ImageHandle(handle, zoom);
2301+
ImageHandle imageHandle = new ImageHandle(handle, zoom, -1);
23022302
zoomLevelToImageHandle.put(zoom, imageHandle);
23032303
return imageHandle;
23042304
}
@@ -2494,7 +2494,7 @@ ImageHandle initNative(String filename, int zoom) {
24942494
long[] hicon = new long[1];
24952495
status = Gdip.Bitmap_GetHICON(bitmap, hicon);
24962496
handle = hicon[0];
2497-
imageMetadata = new ImageHandle(handle, zoom);
2497+
imageMetadata = new ImageHandle(handle, zoom, -1);
24982498
} else {
24992499
type = SWT.BITMAP;
25002500
width = Gdip.Image_GetWidth(bitmap);
@@ -2812,10 +2812,6 @@ class ImageHandle {
28122812
final int transparentPixel;
28132813
int transparentColor = -1;
28142814

2815-
ImageHandle(long handle, int zoom) {
2816-
this(handle, zoom, -1);
2817-
}
2818-
28192815
ImageHandle(long handle, int zoom, int transparentPixel) {
28202816
this.handle = handle;
28212817
this.zoom = zoom;

0 commit comments

Comments
 (0)