Skip to content

Commit 3e45b23

Browse files
akoch-yattaHeikoKlare
authored andcommitted
[win32] do not call getImageData on getBounds call
This commit unifies the getBounds calculation for ImageDataProvider and ImageFileNameProvider by always scaling the bounds of an existing handle of an image, if the bounds for a different zoom are requested. fixes #1639
1 parent 00c2cf3 commit 3e45b23

File tree

1 file changed

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

1 file changed

+3
-3
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -2185,9 +2185,9 @@ private class ImageDataProviderWrapper extends AbstractImageProviderWrapper {
21852185

21862186
@Override
21872187
protected Rectangle getBounds(int zoom) {
2188-
ElementAtZoom<ImageData> data = DPIUtil.validateAndGetImageDataAtZoom (provider, zoom);
2189-
Rectangle rectangle = new Rectangle(0, 0, data.element().width, data.element().height);
2190-
return DPIUtil.scaleBounds(rectangle, zoom, data.zoom());
2188+
ImageHandle imageHandle = zoomLevelToImageHandle.values().iterator().next();
2189+
Rectangle rectangle = new Rectangle(0, 0, imageHandle.width, imageHandle.height);
2190+
return DPIUtil.scaleBounds(rectangle, zoom, imageHandle.zoom);
21912191
}
21922192

21932193
@Override

0 commit comments

Comments
 (0)