@@ -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 ;
@@ -2089,26 +2089,26 @@ public void close() {
20892089}
20902090
20912091private class ImageHandle {
2092- final long handle ;
2093- final int zoom ;
2094- int height ;
2095- int width ;
2092+ private final long handle ;
2093+ private final int zoom ;
2094+ private int height ;
2095+ private int width ;
20962096
20972097 public ImageHandle (long handle , int zoom ) {
2098- Rectangle bounds = getBoundsInPixelsFromNative (handle );
20992098 this .handle = handle ;
21002099 this .zoom = zoom ;
2101- this .height = bounds .height ;
2102- this .width = bounds .width ;
2100+ updateBoundsInPixelsFromNative ();
21032101 setImageMetadataForHandle (this , zoom );
21042102 }
21052103
2106- private Rectangle getBoundsInPixelsFromNative ( long handle ) {
2104+ private void updateBoundsInPixelsFromNative ( ) {
21072105 switch (type ) {
21082106 case SWT .BITMAP :
21092107 BITMAP bm = new BITMAP ();
21102108 OS .GetObject (handle , BITMAP .sizeof , bm );
2111- return new Rectangle (0 , 0 , width = bm .bmWidth , height = bm .bmHeight );
2109+ width = bm .bmWidth ;
2110+ height = bm .bmHeight ;
2111+ return ;
21122112 case SWT .ICON :
21132113 ICONINFO info = new ICONINFO ();
21142114 OS .GetIconInfo (handle , info );
@@ -2119,10 +2119,11 @@ private Rectangle getBoundsInPixelsFromNative(long handle) {
21192119 if (hBitmap == info .hbmMask ) bm .bmHeight /= 2 ;
21202120 if (info .hbmColor != 0 ) OS .DeleteObject (info .hbmColor );
21212121 if (info .hbmMask != 0 ) OS .DeleteObject (info .hbmMask );
2122- return new Rectangle (0 , 0 , width = bm .bmWidth , height = bm .bmHeight );
2122+ width = bm .bmWidth ;
2123+ height = bm .bmHeight ;
2124+ return ;
21232125 default :
21242126 SWT .error (SWT .ERROR_INVALID_IMAGE );
2125- return null ;
21262127 }
21272128 }
21282129
0 commit comments