@@ -1772,16 +1772,16 @@ else if (i.alphaData != null) {
17721772 if (hIcon == 0 ) SWT .error (SWT .ERROR_NO_HANDLES );
17731773 OS .DeleteObject (hBitmap );
17741774 OS .DeleteObject (hMask );
1775- image .new ImageHandle (hIcon , zoom );
17761775 image .type = SWT .ICON ;
1776+ image .new ImageHandle (hIcon , zoom );
17771777 }
17781778 } else {
17791779 if (image == null ) {
17801780 result = new long []{hDib };
17811781 } else {
1782- image .new ImageHandle (hDib , zoom );
17831782 image .type = SWT .BITMAP ;
17841783 image .transparentPixel = i .transparentPixel ;
1784+ image .new ImageHandle (hDib , zoom );
17851785 }
17861786 }
17871787 return result ;
@@ -2092,26 +2092,26 @@ public void close() {
20922092}
20932093
20942094private 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 ;
20992099
21002100 public ImageHandle (long handle , int zoom ) {
2101- Rectangle bounds = getBoundsInPixelsFromNative (handle );
21022101 this .handle = handle ;
21032102 this .zoom = zoom ;
2104- this .height = bounds .height ;
2105- this .width = bounds .width ;
2103+ updateBoundsInPixelsFromNative ();
21062104 setImageMetadataForHandle (this , zoom );
21072105 }
21082106
2109- private Rectangle getBoundsInPixelsFromNative ( long handle ) {
2107+ private void updateBoundsInPixelsFromNative ( ) {
21102108 switch (type ) {
21112109 case SWT .BITMAP :
21122110 BITMAP bm = new BITMAP ();
21132111 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 ;
21152115 case SWT .ICON :
21162116 ICONINFO info = new ICONINFO ();
21172117 OS .GetIconInfo (handle , info );
@@ -2122,10 +2122,11 @@ private Rectangle getBoundsInPixelsFromNative(long handle) {
21222122 if (hBitmap == info .hbmMask ) bm .bmHeight /= 2 ;
21232123 if (info .hbmColor != 0 ) OS .DeleteObject (info .hbmColor );
21242124 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 ;
21262128 default :
21272129 SWT .error (SWT .ERROR_INVALID_IMAGE );
2128- return null ;
21292130 }
21302131 }
21312132
0 commit comments