@@ -1554,8 +1554,6 @@ LRESULT WM_PAINT (long wParam, long lParam) {
1554
1554
data .ps = ps ;
1555
1555
data .hwnd = handle ;
1556
1556
GC gc = GC .win32_new (this , data );
1557
-
1558
- /* Get the system region for the paint HDC */
1559
1557
long sysRgn = 0 ;
1560
1558
if ((style & (SWT .DOUBLE_BUFFERED | SWT .TRANSPARENT )) != 0 || (style & SWT .NO_MERGE_PAINTS ) != 0 ) {
1561
1559
sysRgn = OS .CreateRectRgn (0 , 0 , 0 , 0 );
@@ -1581,14 +1579,25 @@ LRESULT WM_PAINT (long wParam, long lParam) {
1581
1579
GC paintGC = null ;
1582
1580
Image image = null ;
1583
1581
if ((style & (SWT .DOUBLE_BUFFERED | SWT .TRANSPARENT )) != 0 ) {
1584
- image = new Image (display , width , height );
1585
1582
paintGC = gc ;
1586
- gc = new GC (image , paintGC .getStyle () & SWT .RIGHT_TO_LEFT );
1587
- GCData gcData = gc .getGCData ();
1588
- gcData .uiState = data .uiState ;
1589
- gc .setForeground (getForeground ());
1590
- gc .setBackground (getBackground ());
1591
- gc .setFont (getFont ());
1583
+ int originalStyle = gc .getStyle ();
1584
+ ImageGcDrawer drawer = new ImageGcDrawer () {
1585
+ @ Override
1586
+ public void drawOn (GC gc , int iWidth , int iHeight ) {
1587
+ GCData gcData = gc .getGCData ();
1588
+ gcData .uiState = data .uiState ;
1589
+ gc .setForeground (getForeground ());
1590
+ gc .setBackground (getBackground ());
1591
+ gc .setFont (getFont ());
1592
+
1593
+ }
1594
+
1595
+ @ Override
1596
+ public int getGcStyle () {
1597
+ return originalStyle & SWT .RIGHT_TO_LEFT ;
1598
+ }
1599
+ };
1600
+ image = new Image (display , drawer , width , height );
1592
1601
if ((style & SWT .TRANSPARENT ) != 0 ) {
1593
1602
OS .BitBlt (gc .handle , 0 , 0 , width , height , paintGC .handle , ps .left , ps .top , OS .SRCCOPY );
1594
1603
}
0 commit comments