Skip to content

Commit 142dc7a

Browse files
akoch-yattaHeikoKlare
authored andcommitted
[win32] Fix double buffer paint with ImageGcDrawer
This commit fixes a regression introduced with f10721a that did not properly retain the currently drawn zoom level when an ImageGcDrawer is used. That leads to issues with zoom != 100.
1 parent 0e0d38c commit 142dc7a

File tree

1 file changed

+12
-1
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics

1 file changed

+12
-1
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1691,7 +1691,7 @@ private ImageHandle init(ImageData i, int zoom) {
16911691
*/
16921692
@Override
16931693
public long internal_new_GC (GCData data) {
1694-
return configureGC(data, 100);
1694+
return this.imageProvider.configureGCData(data);
16951695
}
16961696

16971697
private long configureGC(GCData data, int zoom) {
@@ -1854,6 +1854,10 @@ private abstract class AbstractImageProviderWrapper {
18541854

18551855
protected abstract Rectangle getBounds(int zoom);
18561856

1857+
protected long configureGCData(GCData data) {
1858+
return configureGC(data, 100);
1859+
}
1860+
18571861
public Collection<Integer> getPreservedZoomLevels() {
18581862
return Collections.emptySet();
18591863
}
@@ -2480,6 +2484,7 @@ private class ImageGcDrawerWrapper extends DynamicImageProviderWrapper {
24802484
private ImageGcDrawer drawer;
24812485
private int width;
24822486
private int height;
2487+
private int currentZoom = 100;
24832488

24842489
ImageGcDrawerWrapper(ImageGcDrawer imageGcDrawer, int width, int height) {
24852490
checkProvider(imageGcDrawer, ImageGcDrawer.class);
@@ -2494,13 +2499,19 @@ protected Rectangle getBounds(int zoom) {
24942499
return DPIUtil.scaleBounds(rectangle, zoom, 100);
24952500
}
24962501

2502+
@Override
2503+
protected long configureGCData(GCData data) {
2504+
return configureGC(data, currentZoom);
2505+
}
2506+
24972507
@Override
24982508
ImageData newImageData(int zoom) {
24992509
return getImageMetadata(zoom).getImageData();
25002510
}
25012511

25022512
@Override
25032513
protected ImageHandle newImageHandle(int zoom) {
2514+
currentZoom = zoom;
25042515
int gcStyle = drawer.getGcStyle();
25052516
Image image;
25062517
if ((gcStyle & SWT.TRANSPARENT) != 0) {

0 commit comments

Comments
 (0)