diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java index f360f696dd5..46697419291 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java @@ -1553,8 +1553,6 @@ LRESULT WM_PAINT (long wParam, long lParam) { data.ps = ps; data.hwnd = handle; GC gc = GC.win32_new (this, data); - - /* Get the system region for the paint HDC */ long sysRgn = 0; if ((style & (SWT.DOUBLE_BUFFERED | SWT.TRANSPARENT)) != 0 || (style & SWT.NO_MERGE_PAINTS) != 0) { sysRgn = OS.CreateRectRgn (0, 0, 0, 0); @@ -1580,14 +1578,25 @@ LRESULT WM_PAINT (long wParam, long lParam) { GC paintGC = null; Image image = null; if ((style & (SWT.DOUBLE_BUFFERED | SWT.TRANSPARENT)) != 0) { - image = new Image (display, width, height); paintGC = gc; - gc = new GC (image, paintGC.getStyle() & SWT.RIGHT_TO_LEFT); - GCData gcData = gc.getGCData (); - gcData.uiState = data.uiState; - gc.setForeground (getForeground ()); - gc.setBackground (getBackground ()); - gc.setFont (getFont ()); + int originalStyle = gc.getStyle(); + ImageGcDrawer drawer = new ImageGcDrawer() { + @Override + public void drawOn(GC gc, int iWidth, int iHeight) { + GCData gcData = gc.getGCData (); + gcData.uiState = data.uiState; + gc.setForeground (getForeground ()); + gc.setBackground (getBackground ()); + gc.setFont (getFont ()); + + } + + @Override + public int getGcStyle() { + return originalStyle & SWT.RIGHT_TO_LEFT; + } + }; + image = new Image (display, drawer, width, height); if ((style & SWT.TRANSPARENT) != 0) { OS.BitBlt (gc.handle, 0, 0, width, height, paintGC.handle, ps.left, ps.top, OS.SRCCOPY); }