Skip to content

Commit 3bfde61

Browse files
arunjose696HeikoKlare
authored andcommitted
Fix wrong cursor size when ImageData is unavailable at zoom
Previously, the cursor used DPIUtil.validateAndGetImageDataAtZoom() to retrieve image data, which may return Imagedata at a different zoom level than requested if ImageData for the exact zoom is unavailable. This led to incorrect scaling when the returned image data was treated as if it matched the requested zoom. This commit replaces that logic with a temporary Image and calling Image.getImageData(zoom) to retrieve image data for the requested zoom level.
1 parent 216f1ad commit 3bfde61

File tree

1 file changed

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

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,9 @@ public static Long win32_getHandle (Cursor cursor, int zoom) {
421421
} else {
422422
ImageData source;
423423
if (cursor.imageDataProvider != null) {
424-
source = DPIUtil.validateAndGetImageDataAtZoom(cursor.imageDataProvider, zoom).element();
424+
Image tempImage = new Image(cursor.getDevice(), cursor.imageDataProvider);
425+
source = tempImage.getImageData(zoom);
426+
tempImage.dispose();
425427
}
426428
else {
427429
source = DPIUtil.scaleImageData(cursor.device, cursor.source, zoom, DEFAULT_ZOOM);

0 commit comments

Comments
 (0)