From 404155d314bf4d30793c578942994e517f420a26 Mon Sep 17 00:00:00 2001 From: Andreas Koch Date: Fri, 31 Jan 2025 09:53:14 +0100 Subject: [PATCH] [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 https://github.com/eclipse-platform/eclipse.platform.swt/issues/1639 --- .../Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java index 9f9181909ca..e4cdd372a6b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java @@ -2185,9 +2185,9 @@ private class ImageDataProviderWrapper extends AbstractImageProviderWrapper { @Override protected Rectangle getBounds(int zoom) { - ElementAtZoom data = DPIUtil.validateAndGetImageDataAtZoom (provider, zoom); - Rectangle rectangle = new Rectangle(0, 0, data.element().width, data.element().height); - return DPIUtil.scaleBounds(rectangle, zoom, data.zoom()); + ImageHandle imageHandle = zoomLevelToImageHandle.values().iterator().next(); + Rectangle rectangle = new Rectangle(0, 0, imageHandle.width, imageHandle.height); + return DPIUtil.scaleBounds(rectangle, zoom, imageHandle.zoom); } @Override