@@ -1772,16 +1772,16 @@ else if (i.alphaData != null) {
1772
1772
if (hIcon == 0 ) SWT .error (SWT .ERROR_NO_HANDLES );
1773
1773
OS .DeleteObject (hBitmap );
1774
1774
OS .DeleteObject (hMask );
1775
- image .new ImageHandle (hIcon , zoom );
1776
1775
image .type = SWT .ICON ;
1776
+ image .new ImageHandle (hIcon , zoom );
1777
1777
}
1778
1778
} else {
1779
1779
if (image == null ) {
1780
1780
result = new long []{hDib };
1781
1781
} else {
1782
- image .new ImageHandle (hDib , zoom );
1783
1782
image .type = SWT .BITMAP ;
1784
1783
image .transparentPixel = i .transparentPixel ;
1784
+ image .new ImageHandle (hDib , zoom );
1785
1785
}
1786
1786
}
1787
1787
return result ;
@@ -2092,26 +2092,26 @@ public void close() {
2092
2092
}
2093
2093
2094
2094
private class ImageHandle {
2095
- final long handle ;
2096
- final int zoom ;
2097
- int height ;
2098
- int width ;
2095
+ private final long handle ;
2096
+ private final int zoom ;
2097
+ private int height ;
2098
+ private int width ;
2099
2099
2100
2100
public ImageHandle (long handle , int zoom ) {
2101
- Rectangle bounds = getBoundsInPixelsFromNative (handle );
2102
2101
this .handle = handle ;
2103
2102
this .zoom = zoom ;
2104
- this .height = bounds .height ;
2105
- this .width = bounds .width ;
2103
+ updateBoundsInPixelsFromNative ();
2106
2104
setImageMetadataForHandle (this , zoom );
2107
2105
}
2108
2106
2109
- private Rectangle getBoundsInPixelsFromNative ( long handle ) {
2107
+ private void updateBoundsInPixelsFromNative ( ) {
2110
2108
switch (type ) {
2111
2109
case SWT .BITMAP :
2112
2110
BITMAP bm = new BITMAP ();
2113
2111
OS .GetObject (handle , BITMAP .sizeof , bm );
2114
- return new Rectangle (0 , 0 , width = bm .bmWidth , height = bm .bmHeight );
2112
+ width = bm .bmWidth ;
2113
+ height = bm .bmHeight ;
2114
+ return ;
2115
2115
case SWT .ICON :
2116
2116
ICONINFO info = new ICONINFO ();
2117
2117
OS .GetIconInfo (handle , info );
@@ -2122,10 +2122,11 @@ private Rectangle getBoundsInPixelsFromNative(long handle) {
2122
2122
if (hBitmap == info .hbmMask ) bm .bmHeight /= 2 ;
2123
2123
if (info .hbmColor != 0 ) OS .DeleteObject (info .hbmColor );
2124
2124
if (info .hbmMask != 0 ) OS .DeleteObject (info .hbmMask );
2125
- return new Rectangle (0 , 0 , width = bm .bmWidth , height = bm .bmHeight );
2125
+ width = bm .bmWidth ;
2126
+ height = bm .bmHeight ;
2127
+ return ;
2126
2128
default :
2127
2129
SWT .error (SWT .ERROR_INVALID_IMAGE );
2128
- return null ;
2129
2130
}
2130
2131
}
2131
2132
0 commit comments