From a26032dc5c3bef2a5d6171e890fa940a122a0905 Mon Sep 17 00:00:00 2001 From: Amartya Parijat Date: Fri, 26 Jul 2024 15:26:02 +0200 Subject: [PATCH] Replaced DPIUtil.get(Native)DeviceZoom calls This commit replaces DPIUtil.get(Native)DeviceZoom calls for win32 and uses the zoom information available within the controls. contributes to #62 and #127 --- .../win32/org/eclipse/swt/dnd/TableDragSourceEffect.java | 2 +- .../win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java | 2 +- .../Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java index 8eac76a3423..44012702f64 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java @@ -147,7 +147,7 @@ Image getDragSourceImage(DragSourceEvent event) { data.transparentPixel = shdi.crColorKey << 8; } Display display = control.getDisplay(); - dragSourceImage = new Image(display, new AutoScaleImageDataProvider(display, data, DPIUtil.getDeviceZoom())); + dragSourceImage = new Image(display, new AutoScaleImageDataProvider(display, data, DPIUtil.getZoomForAutoscaleProperty(control.nativeZoom))); OS.SelectObject (memHdc, oldMemBitmap); OS.DeleteDC (memHdc); OS.DeleteObject (memDib); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java index 363bf9c581b..3e084e64549 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java @@ -146,7 +146,7 @@ Image getDragSourceImage(DragSourceEvent event) { data.transparentPixel = shdi.crColorKey << 8; } Display display = control.getDisplay (); - dragSourceImage = new Image (display, new AutoScaleImageDataProvider(display, data, DPIUtil.getDeviceZoom())); + dragSourceImage = new Image (display, new AutoScaleImageDataProvider(display, data, DPIUtil.getZoomForAutoscaleProperty(control.nativeZoom))); OS.SelectObject (memHdc, oldMemBitmap); OS.DeleteDC (memHdc); OS.DeleteObject (memDib); 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 835497b8e1c..afed0488e7e 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 @@ -2229,7 +2229,7 @@ public long internal_new_GC (GCData data) { data.device = device; data.nativeZoom = initialNativeZoom; data.image = this; - data.font = SWTFontProvider.getSystemFont(device, DPIUtil.getNativeDeviceZoom()); + data.font = SWTFontProvider.getSystemFont(device, initialNativeZoom); } return imageDC; }