@@ -4461,6 +4461,15 @@ private long identity() {
44614461 return Gdip .Matrix_new (1 , 0 , 0 , 1 , 0 , 0 );
44624462}
44634463
4464+ private void initWithImageHandle (Drawable drawable , GCData data , long hDC , ImageHandle imageHandle ) {
4465+ Image image = data .image ;
4466+ data .image = null ;
4467+ init (drawable , data , hDC );
4468+ data .hNullBitmap = OS .SelectObject (hDC , imageHandle .getHandle ());
4469+ image .memGC = this ;
4470+ data .image = image ;
4471+ }
4472+
44644473private void init (Drawable drawable , GCData data , long hDC ) {
44654474 int foreground = data .foreground ;
44664475 if (foreground != -1 ) {
@@ -5935,12 +5944,12 @@ Point textExtentInPixels(String string, int flags) {
59355944 return new Point (rect .right , rect .bottom );
59365945}
59375946
5938- void refreshFor (Drawable drawable ) {
5947+ void refreshFor (Drawable drawable , ImageHandle imageHandle ) {
59395948 if (drawable == null ) SWT .error (SWT .ERROR_NULL_ARGUMENT );
59405949 destroy ();
59415950 GCData newData = new GCData ();
59425951 originalData .copyTo (newData );
5943- createGcHandle (drawable , newData );
5952+ createGcHandle (drawable , newData , imageHandle );
59445953}
59455954
59465955/**
@@ -6059,10 +6068,10 @@ private void removePreviousOperationIfSupercededBy(Operation operation) {
60596068 }
60606069}
60616070
6062- private void createGcHandle (Drawable drawable , GCData newData ) {
6071+ private void createGcHandle (Drawable drawable , GCData newData , ImageHandle imageHandle ) {
60636072 long newHandle = drawable .internal_new_GC (newData );
60646073 if (newHandle == 0 ) SWT .error (SWT .ERROR_NO_HANDLES );
6065- init (drawable , newData , newHandle );
6074+ initWithImageHandle (drawable , newData , newHandle , imageHandle );
60666075 for (Operation operation : operations ) {
60676076 operation .apply ();
60686077 }
0 commit comments