Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 272273 Details for
Bug 480639
[HiDPI][API] Provide monitor-specific DPI scaling / zoom level
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
(partial) fix
patch.txt (text/plain), 43.79 KB, created by
S. Schulz
on 2018-01-16 02:10:14 EST
(
hide
)
Description:
(partial) fix
Filename:
MIME Type:
Creator:
S. Schulz
Created:
2018-01-16 02:10:14 EST
Size:
43.79 KB
patch
obsolete
>diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java >index fe972bd..dd1a1fe 100644 >--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java >+++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java >@@ -613,4 +613,8 @@ > handle = 0; > } > >+@Override >+protected int getDeviceZoom() { >+ return 100; // printers don't zoom >+} > } >diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java >index 17708de..9b62eb5 100644 >--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java >+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java >@@ -12,6 +12,7 @@ > > import org.eclipse.swt.*; > import org.eclipse.swt.graphics.*; >+import org.eclipse.swt.widgets.*; > > /** > * This class hold common constants and utility functions w.r.t. to SWT high DPI >@@ -87,14 +88,23 @@ > * Auto-scale down ImageData > */ > public static ImageData autoScaleDown (Device device, final ImageData imageData) { >- if (deviceZoom == 100 || imageData == null || (device != null && !device.isAutoScalable())) return imageData; >- float scaleFactor = 1.0f / getScalingFactor (); >+ if (device.getZoom() == 100 || imageData == null || (device != null && !device.isAutoScalable())) return imageData; >+ float scaleFactor = 1.0f / getScalingFactor (device); > return autoScaleImageData(device, imageData, scaleFactor); > } > >+/** >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleDown(Device, int[])}. >+ */ >+ >+@Deprecated > public static int[] autoScaleDown(int[] pointArray) { >- if (deviceZoom == 100 || pointArray == null) return pointArray; >- float scaleFactor = getScalingFactor (); >+ return autoScaleDown(Display.getDefault(),pointArray); >+} >+ >+public static int[] autoScaleDown(Device device,int[] pointArray) { >+ if (device.getZoom() == 100 || pointArray == null) return pointArray; >+ float scaleFactor = getScalingFactor (device); > int [] returnArray = new int[pointArray.length]; > for (int i = 0; i < pointArray.length; i++) { > returnArray [i] = Math.round (pointArray [i] / scaleFactor); >@@ -102,17 +112,34 @@ > return returnArray; > } > >+/** >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleDown(Device, Drawable, int[])}. >+ */ >+ >+@Deprecated > public static int[] autoScaleDown(Drawable drawable, int[] pointArray) { >+ return autoScaleDown (Display.getDefault(), drawable, pointArray); >+} >+ >+public static int[] autoScaleDown(Device device, Drawable drawable, int[] pointArray) { > if (drawable != null && !drawable.isAutoScalable ()) return pointArray; >- return autoScaleDown (pointArray); >+ return autoScaleDown (device, pointArray); > } > > /** > * Auto-scale up float array dimensions. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleDown(Device, float[])}. > */ >+@Deprecated > public static float[] autoScaleDown (float size[]) { >- if (deviceZoom == 100 || size == null) return size; >- float scaleFactor = getScalingFactor (); >+ return autoScaleDown(Display.getDefault(), size); >+} >+/** >+ * Auto-scale up float array dimensions. >+ */ >+public static float[] autoScaleDown (Device device, float size[]) { >+ if (device.getZoom() == 100 || size == null) return size; >+ float scaleFactor = getScalingFactor (device); > float scaledSize[] = new float[size.length]; > for (int i = 0; i < scaledSize.length; i++) { > scaledSize[i] = size[i] / scaleFactor; >@@ -122,51 +149,98 @@ > > /** > * Auto-scale up float array dimensions if enabled for Drawable class. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleDown(Device, Drawable, float[])}. > */ >+@Deprecated > public static float[] autoScaleDown (Drawable drawable, float size[]) { >+ return autoScaleDown(Display.getDefault(), drawable, size); >+} >+/** >+ * Auto-scale up float array dimensions if enabled for Drawable class. >+ */ >+public static float[] autoScaleDown (Device device,Drawable drawable, float size[]) { > if (drawable != null && !drawable.isAutoScalable ()) return size; >- return autoScaleDown (size); >+ return autoScaleDown (device, size); > } > > /** > * Auto-scale down int dimensions. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleDown(Device, int)}. > */ >+@Deprecated > public static int autoScaleDown (int size) { >- if (deviceZoom == 100 || size == SWT.DEFAULT) return size; >- float scaleFactor = getScalingFactor (); >+ return autoScaleDown(Display.getDefault(), size); >+} >+/** >+ * Auto-scale down int dimensions. >+ */ >+public static int autoScaleDown (Device device, int size) { >+ if (device.getZoom() == 100 || size == SWT.DEFAULT) return size; >+ float scaleFactor = getScalingFactor (device); > return Math.round (size / scaleFactor); > } > /** > * Auto-scale down int dimensions if enabled for Drawable class. > */ > public static int autoScaleDown (Drawable drawable, int size) { >+ return autoScaleDown (Display.getDefault(), drawable, size); >+} >+ >+/** >+ * Auto-scale down int dimensions if enabled for Drawable class. >+ */ >+public static int autoScaleDown (Device device, Drawable drawable, int size) { > if (drawable != null && !drawable.isAutoScalable ()) return size; >- return autoScaleDown (size); >+ return autoScaleDown (device, size); > } > > /** > * Auto-scale down float dimensions. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleDown(Device, float)}. > */ >+@Deprecated > public static float autoScaleDown (float size) { >- if (deviceZoom == 100 || size == SWT.DEFAULT) return size; >- float scaleFactor = getScalingFactor (); >+ return autoScaleDown(Display.getDefault(), size); >+} >+/** >+ * Auto-scale down float dimensions. >+ */ >+public static float autoScaleDown (Device device,float size) { >+ if (device.getZoom() == 100 || size == SWT.DEFAULT) return size; >+ float scaleFactor = getScalingFactor (device); > return (size / scaleFactor); > } > > /** > * Auto-scale down float dimensions if enabled for Drawable class. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleDown(Device, Drawable, float)}. > */ >+@Deprecated > public static float autoScaleDown (Drawable drawable, float size) { >+ return autoScaleDown(Display.getDefault(),drawable, size); >+} >+/** >+ * Auto-scale down float dimensions if enabled for Drawable class. >+ */ >+public static float autoScaleDown (Device device, Drawable drawable, float size) { > if (drawable != null && !drawable.isAutoScalable ()) return size; >- return autoScaleDown (size); >+ return autoScaleDown (device, size); > } > > /** > * Returns a new scaled down Point. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleDown(Device, Point)}. > */ >+@Deprecated > public static Point autoScaleDown (Point point) { >- if (deviceZoom == 100 || point == null) return point; >- float scaleFactor = getScalingFactor (); >+ return autoScaleDown(Display.getDefault(), point); >+} >+/** >+ * Returns a new scaled down Point. >+ */ >+public static Point autoScaleDown (Device device, Point point) { >+ if (device.getZoom() == 100 || point == null) return point; >+ float scaleFactor = getScalingFactor (device); > Point scaledPoint = new Point (0,0); > scaledPoint.x = Math.round (point.x / scaleFactor); > scaledPoint.y = Math.round (point.y / scaleFactor); >@@ -175,20 +249,37 @@ > > /** > * Returns a new scaled down Point if enabled for Drawable class. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleDown(Device, Drawable, Point)}. > */ >+@Deprecated > public static Point autoScaleDown (Drawable drawable, Point point) { >+ return autoScaleDown (Display.getDefault(), drawable, point); >+} >+ >+/** >+ * Returns a new scaled down Point if enabled for Drawable class. >+ */ >+public static Point autoScaleDown (Device device, Drawable drawable, Point point) { > if (drawable != null && !drawable.isAutoScalable ()) return point; >- return autoScaleDown (point); >+ return autoScaleDown (device, point); > } > > /** > * Returns a new scaled down Rectangle. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleDown(Device, Rectangle)}. > */ >+@Deprecated > public static Rectangle autoScaleDown (Rectangle rect) { >- if (deviceZoom == 100 || rect == null) return rect; >+ return autoScaleDown(Display.getDefault(), rect); >+} >+/** >+ * Returns a new scaled down Rectangle. >+ */ >+public static Rectangle autoScaleDown (Device device, Rectangle rect) { >+ if (device.getZoom() == 100 || rect == null) return rect; > Rectangle scaledRect = new Rectangle (0,0,0,0); >- Point scaledTopLeft = DPIUtil.autoScaleDown (new Point (rect.x, rect.y)); >- Point scaledBottomRight = DPIUtil.autoScaleDown (new Point (rect.x + rect.width, rect.y + rect.height)); >+ Point scaledTopLeft = DPIUtil.autoScaleDown (device, new Point (rect.x, rect.y)); >+ Point scaledBottomRight = DPIUtil.autoScaleDown (device, new Point (rect.x + rect.width, rect.y + rect.height)); > > scaledRect.x = scaledTopLeft.x; > scaledRect.y = scaledTopLeft.y; >@@ -198,8 +289,16 @@ > } > /** > * Returns a new scaled down Rectangle if enabled for Drawable class. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleDown(Device, Drawable, Rectangle)}. > */ >+@Deprecated > public static Rectangle autoScaleDown (Drawable drawable, Rectangle rect) { >+ return autoScaleDown(Display.getDefault(), drawable, rect); >+} >+/** >+ * Returns a new scaled down Rectangle if enabled for Drawable class. >+ */ >+public static Rectangle autoScaleDown (Device device, Drawable drawable, Rectangle rect) { > if (drawable != null && !drawable.isAutoScalable ()) return rect; > return autoScaleDown (rect); > } >@@ -230,14 +329,14 @@ > Image resultImage = new Image (device, (ImageDataProvider) zoom -> resultData); > GC gc = new GC (resultImage); > gc.setAntialias (SWT.ON); >- gc.drawImage (original, 0, 0, DPIUtil.autoScaleDown (width), DPIUtil.autoScaleDown (height), >+ gc.drawImage (original, 0, 0, DPIUtil.autoScaleDown (device, width), DPIUtil.autoScaleDown (height), > /* E.g. destWidth here is effectively DPIUtil.autoScaleDown (scaledWidth), but avoiding rounding errors. > * Nevertheless, we still have some rounding errors due to the point-based API GC#drawImage(..). > */ >- 0, 0, Math.round (DPIUtil.autoScaleDown ((float) width * scaleFactor)), Math.round (DPIUtil.autoScaleDown ((float) height * scaleFactor))); >+ 0, 0, Math.round (DPIUtil.autoScaleDown (device, (float) width * scaleFactor)), Math.round (DPIUtil.autoScaleDown ((float) height * scaleFactor))); > gc.dispose (); > original.dispose (); >- ImageData result = resultImage.getImageData (DPIUtil.getDeviceZoom ()); >+ ImageData result = resultImage.getImageData (device.getZoom ()); > resultImage.dispose (); > return result; > case NEAREST: >@@ -248,9 +347,17 @@ > > /** > * Returns a new rectangle as per the scaleFactor. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleBounds(Device, Rectangle, int, int)}. > */ >+@Deprecated > public static Rectangle autoScaleBounds (Rectangle rect, int targetZoom, int currentZoom) { >- if (deviceZoom == 100 || rect == null || targetZoom == currentZoom) return rect; >+ return autoScaleBounds(Display.getDefault(), rect, targetZoom, currentZoom); >+} >+/** >+ * Returns a new rectangle as per the scaleFactor. >+ */ >+public static Rectangle autoScaleBounds (Device device, Rectangle rect, int targetZoom, int currentZoom) { >+ if (device.getZoom() == 100 || rect == null || targetZoom == currentZoom) return rect; > float scaleFactor = ((float)targetZoom) / (float)currentZoom; > Rectangle returnRect = new Rectangle (0,0,0,0); > returnRect.x = Math.round (rect.x * scaleFactor); >@@ -264,14 +371,22 @@ > * Auto-scale up ImageData > */ > public static ImageData autoScaleUp (Device device, final ImageData imageData) { >- if (deviceZoom == 100 || imageData == null || (device != null && !device.isAutoScalable())) return imageData; >- float scaleFactor = getScalingFactor (); >+ if (device.getZoom() == 100 || imageData == null || (device != null && !device.isAutoScalable())) return imageData; >+ float scaleFactor = getScalingFactor (device); > return autoScaleImageData(device, imageData, scaleFactor); > } > >+/** >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleUp(Device, int[])}. >+ */ >+ >+@Deprecated > public static int[] autoScaleUp(int[] pointArray) { >- if (deviceZoom == 100 || pointArray == null) return pointArray; >- float scaleFactor = getScalingFactor (); >+ return autoScaleUp(Display.getDefault(), pointArray); >+} >+public static int[] autoScaleUp(Device device, int[] pointArray) { >+ if (device.getZoom() == 100 || pointArray == null) return pointArray; >+ float scaleFactor = getScalingFactor (device); > int [] returnArray = new int[pointArray.length]; > for (int i = 0; i < pointArray.length; i++) { > returnArray [i] = Math.round (pointArray [i] * scaleFactor); >@@ -279,17 +394,35 @@ > return returnArray; > } > >+ >+/** >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleUp(Device, Drawable, int[])}. >+ */ >+ >+@Deprecated > public static int[] autoScaleUp(Drawable drawable, int[] pointArray) { >+ return autoScaleUp(Display.getDefault(), drawable, pointArray); >+} >+ >+public static int[] autoScaleUp(Device device, Drawable drawable, int[] pointArray) { > if (drawable != null && !drawable.isAutoScalable ()) return pointArray; >- return autoScaleUp (pointArray); >+ return autoScaleUp (device, pointArray); > } > > /** > * Auto-scale up int dimensions. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleUp(Device, int)}. > */ >+@Deprecated > public static int autoScaleUp (int size) { >- if (deviceZoom == 100 || size == SWT.DEFAULT) return size; >- float scaleFactor = getScalingFactor (); >+ return autoScaleUp(Display.getDefault(), size); >+} >+/** >+ * Auto-scale up int dimensions. >+ */ >+public static int autoScaleUp (Device device, int size) { >+ if (device.getZoom() == 100 || size == SWT.DEFAULT) return size; >+ float scaleFactor = getScalingFactor (device); > return Math.round (size * scaleFactor); > } > >@@ -304,29 +437,60 @@ > > /** > * Auto-scale up int dimensions if enabled for Drawable class. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleUp(Device, Drawable, int)}. > */ >+@Deprecated > public static int autoScaleUp (Drawable drawable, int size) { >+ return autoScaleUp(Display.getDefault(),drawable, size); >+} >+/** >+ * Auto-scale up int dimensions if enabled for Drawable class. >+ */ >+public static int autoScaleUp (Device device, Drawable drawable, int size) { > if (drawable != null && !drawable.isAutoScalable ()) return size; >- return autoScaleUp (size); >+ return autoScaleUp (device, size); > } > >+/** >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleUp(Device, float)}. >+ */ >+@Deprecated > public static float autoScaleUp(float size) { >- if (deviceZoom == 100 || size == SWT.DEFAULT) return size; >- float scaleFactor = getScalingFactor (); >+ return autoScaleUp(Display.getDefault(), size); >+} >+public static float autoScaleUp(Device device, float size) { >+ if (device.getZoom() == 100 || size == SWT.DEFAULT) return size; >+ float scaleFactor = getScalingFactor (device); > return (size * scaleFactor); > } > >+/** >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleUp(Device, Drawable, float)}. >+ */ >+ >+@Deprecated > public static float autoScaleUp(Drawable drawable, float size) { >+ return autoScaleUp(Display.getDefault(), drawable, size); >+} >+public static float autoScaleUp(Device device, Drawable drawable, float size) { > if (drawable != null && !drawable.isAutoScalable ()) return size; >- return autoScaleUp (size); >+ return autoScaleUp (device, size); > } > > /** > * Returns a new scaled up Point. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleUp(Device, Point)}. > */ >+@Deprecated > public static Point autoScaleUp (Point point) { >- if (deviceZoom == 100 || point == null) return point; >- float scaleFactor = getScalingFactor (); >+ return autoScaleUp(Display.getDefault(), point); >+} >+/** >+ * Returns a new scaled up Point. >+ */ >+public static Point autoScaleUp (Device device, Point point) { >+ if (device.getZoom() == 100 || point == null) return point; >+ float scaleFactor = getScalingFactor (device); > Point scaledPoint = new Point (0,0); > scaledPoint.x = Math.round (point.x * scaleFactor); > scaledPoint.y = Math.round (point.y * scaleFactor); >@@ -335,20 +499,36 @@ > > /** > * Returns a new scaled up Point if enabled for Drawable class. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleUp(Device, Drawable, Point)}. > */ >+@Deprecated > public static Point autoScaleUp (Drawable drawable, Point point) { >+ return autoScaleUp(Display.getDefault(), drawable, point); >+} >+/** >+ * Returns a new scaled up Point if enabled for Drawable class. >+ */ >+public static Point autoScaleUp (Device device, Drawable drawable, Point point) { > if (drawable != null && !drawable.isAutoScalable ()) return point; >- return autoScaleUp (point); >+ return autoScaleUp (device, point); > } > > /** > * Returns a new scaled up Rectangle. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleUp(Device, Rectangle)}. > */ >+@Deprecated > public static Rectangle autoScaleUp (Rectangle rect) { >- if (deviceZoom == 100 || rect == null) return rect; >+ return autoScaleUp(Display.getDefault(), rect); >+} >+/** >+ * Returns a new scaled up Rectangle. >+ */ >+public static Rectangle autoScaleUp (Device device, Rectangle rect) { >+ if (device.getZoom() == 100 || rect == null) return rect; > Rectangle scaledRect = new Rectangle (0,0,0,0); >- Point scaledTopLeft = DPIUtil.autoScaleUp (new Point (rect.x, rect.y)); >- Point scaledBottomRight = DPIUtil.autoScaleUp (new Point (rect.x + rect.width, rect.y + rect.height)); >+ Point scaledTopLeft = DPIUtil.autoScaleUp (device, new Point (rect.x, rect.y)); >+ Point scaledBottomRight = DPIUtil.autoScaleUp (device, new Point (rect.x + rect.width, rect.y + rect.height)); > > scaledRect.x = scaledTopLeft.x; > scaledRect.y = scaledTopLeft.y; >@@ -359,18 +539,26 @@ > > /** > * Returns a new scaled up Rectangle if enabled for Drawable class. >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link #autoScaleUp(Device, Drawable, Rectangle)}. > */ >+@Deprecated > public static Rectangle autoScaleUp (Drawable drawable, Rectangle rect) { >+ return autoScaleUp(Display.getDefault(), drawable,rect); >+} >+/** >+ * Returns a new scaled up Rectangle if enabled for Drawable class. >+ */ >+public static Rectangle autoScaleUp (Device device, Drawable drawable, Rectangle rect) { > if (drawable != null && !drawable.isAutoScalable ()) return rect; >- return autoScaleUp (rect); >+ return autoScaleUp (device, rect); > } > > /** > * Returns Scaling factor from the display > * @return float scaling factor > */ >-private static float getScalingFactor () { >- return deviceZoom / 100f; >+private static float getScalingFactor (Device device) { >+ return device.getZoom() / 100f; > } > > /** >@@ -413,12 +601,34 @@ > return filename; > } > >+/** >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link Device#getZoom()}. >+ */ >+ >+ >+@Deprecated > public static int getDeviceZoom() { > return deviceZoom; > } > >+/** >+ * @deprecated the device zoom depends on the {@link Device}, so use {@link Device#setZoom(int)}. >+ */ >+ >+@Deprecated > public static void setDeviceZoom (int nativeDeviceZoom) { >- DPIUtil.nativeDeviceZoom = nativeDeviceZoom; >+ deviceZoom = calculateDeviceZoom(nativeDeviceZoom); >+ System.setProperty("org.eclipse.swt.internal.deviceZoom", Integer.toString(deviceZoom)); >+ if (deviceZoom != 100 && autoScaleMethodSetting == AutoScaleMethod.AUTO) { >+ if (deviceZoom / 100 * 100 == deviceZoom || !"gtk".equals(SWT.getPlatform())) { >+ autoScaleMethod = AutoScaleMethod.NEAREST; >+ } else { >+ autoScaleMethod = AutoScaleMethod.SMOOTH; >+ } >+ } >+} >+ >+public static int calculateDeviceZoom (int nativeDeviceZoom) { > int deviceZoom = 0; > String value = System.getProperty (SWT_AUTOSCALE); > if (value != null) { >@@ -444,16 +654,7 @@ > deviceZoom = Math.min (deviceZoom, 200); > } > } >- >- DPIUtil.deviceZoom = deviceZoom; >- System.setProperty("org.eclipse.swt.internal.deviceZoom", Integer.toString(deviceZoom)); >- if (deviceZoom != 100 && autoScaleMethodSetting == AutoScaleMethod.AUTO) { >- if (deviceZoom / 100 * 100 == deviceZoom || !"gtk".equals(SWT.getPlatform())) { >- autoScaleMethod = AutoScaleMethod.NEAREST; >- } else { >- autoScaleMethod = AutoScaleMethod.SMOOTH; >- } >- } >+ return deviceZoom; > } > > /** >diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java >index 47e2bfc..5ae4c3f 100644 >--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java >+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java >@@ -70,6 +70,7 @@ > > /* Auto-Scaling*/ > boolean enableAutoScaling = true; >+ int zoom; > > /* > * TEMPORARY CODE. When a graphics object is >@@ -709,6 +710,8 @@ > /* Initialize the system font slot */ > systemFont = getSystemFont(); > >+ zoom = DPIUtil.calculateDeviceZoom(getDeviceZoom()); >+ > /* Initialize scripts list */ > if (!OS.IsWinCE) { > long /*int*/ [] ppSp = new long /*int*/ [1]; >@@ -1018,4 +1021,13 @@ > return DPIUtil.mapDPIToZoom ( _getDPIx ()); > } > >+ >+void setZoom(int zoom) { >+ this.zoom = zoom; >+} >+ >+public int getZoom() { >+ return zoom; >+} >+ > } >diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontMetrics.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontMetrics.java >index 7ab6e61..919c95b 100644 >--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontMetrics.java >+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontMetrics.java >@@ -39,11 +39,13 @@ > * @noreference This field is not intended to be referenced by clients. > */ > public TEXTMETRIC handle; >+ private Device device; > > /** > * Prevents instances from being created outside the package. > */ >-FontMetrics() { >+FontMetrics(Device device) { >+ this.device=device; > } > > /** >@@ -92,7 +94,7 @@ > * @return the ascent of the font > */ > public int getAscent() { >- return DPIUtil.autoScaleDown(handle.tmAscent - handle.tmInternalLeading); >+ return DPIUtil.autoScaleDown(device, handle.tmAscent - handle.tmInternalLeading); > } > > /** >@@ -102,7 +104,7 @@ > * @return the average character width of the font > */ > public int getAverageCharWidth() { >- return DPIUtil.autoScaleDown(handle.tmAveCharWidth); >+ return DPIUtil.autoScaleDown(device,handle.tmAveCharWidth); > } > > /** >@@ -114,7 +116,7 @@ > * @return the descent of the font > */ > public int getDescent() { >- return DPIUtil.autoScaleDown(handle.tmDescent); >+ return DPIUtil.autoScaleDown(device,handle.tmDescent); > } > > /** >@@ -129,7 +131,7 @@ > * @see #getLeading > */ > public int getHeight() { >- return DPIUtil.autoScaleDown(handle.tmHeight); >+ return DPIUtil.autoScaleDown(device,handle.tmHeight); > } > > /** >@@ -192,8 +194,8 @@ > * > * @noreference This method is not intended to be referenced by clients. > */ >-public static FontMetrics win32_new(TEXTMETRIC handle) { >- FontMetrics fontMetrics = new FontMetrics(); >+public static FontMetrics win32_new(Device device, TEXTMETRIC handle) { >+ FontMetrics fontMetrics = new FontMetrics(device); > fontMetrics.handle = handle; > return fontMetrics; > } >diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java >index 8d8ee8c..7ff0fba 100644 >--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java >+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java >@@ -446,8 +446,8 @@ > * </ul> > */ > public void copyArea (Image image, int x, int y) { >- x = DPIUtil.autoScaleUp(drawable, x); >- y = DPIUtil.autoScaleUp(drawable, y); >+ x = DPIUtil.autoScaleUp(this.device, drawable, x); >+ y = DPIUtil.autoScaleUp(this.device, drawable, y); > copyAreaInPixels(image, x, y); > } > >@@ -502,12 +502,12 @@ > * @since 3.1 > */ > public void copyArea (int srcX, int srcY, int width, int height, int destX, int destY, boolean paint) { >- srcX = DPIUtil.autoScaleUp(drawable, srcX); >- srcY = DPIUtil.autoScaleUp(drawable, srcY); >- width = DPIUtil.autoScaleUp(drawable, width); >- height = DPIUtil.autoScaleUp(drawable, height); >- destX = DPIUtil.autoScaleUp(drawable, destX); >- destY = DPIUtil.autoScaleUp(drawable, destY); >+ srcX = DPIUtil.autoScaleUp(this.device, drawable, srcX); >+ srcY = DPIUtil.autoScaleUp(this.device, drawable, srcY); >+ width = DPIUtil.autoScaleUp(this.device, drawable, width); >+ height = DPIUtil.autoScaleUp(this.device, drawable, height); >+ destX = DPIUtil.autoScaleUp(this.device, drawable, destX); >+ destY = DPIUtil.autoScaleUp(this.device, drawable, destY); > copyAreaInPixels(srcX, srcY, width, height, destX, destY, paint); > } > >@@ -743,10 +743,10 @@ > * </ul> > */ > public void drawArc (int x, int y, int width, int height, int startAngle, int arcAngle) { >- x = DPIUtil.autoScaleUp(drawable, x); >- y = DPIUtil.autoScaleUp(drawable, y); >- width = DPIUtil.autoScaleUp(drawable, width); >- height = DPIUtil.autoScaleUp(drawable, height); >+ x = DPIUtil.autoScaleUp(this.device, drawable, x); >+ y = DPIUtil.autoScaleUp(this.device, drawable, y); >+ width = DPIUtil.autoScaleUp(this.device, drawable, width); >+ height = DPIUtil.autoScaleUp(this.device, drawable, height); > drawArcInPixels(x, y, width, height, startAngle, arcAngle); > } > >@@ -849,10 +849,10 @@ > * @see #drawRectangle(int, int, int, int) > */ > public void drawFocus (int x, int y, int width, int height) { >- x = DPIUtil.autoScaleUp (drawable, x); >- y = DPIUtil.autoScaleUp (drawable, y); >- width = DPIUtil.autoScaleUp (drawable, width); >- height = DPIUtil.autoScaleUp (drawable, height); >+ x = DPIUtil.autoScaleUp (device, drawable, x); >+ y = DPIUtil.autoScaleUp (device, drawable, y); >+ width = DPIUtil.autoScaleUp (device, drawable, width); >+ height = DPIUtil.autoScaleUp (device, drawable, height); > drawFocusInPixels(x, y, width, height); > } > >@@ -927,8 +927,8 @@ > * </ul> > */ > public void drawImage (Image image, int x, int y) { >- x = DPIUtil.autoScaleUp(drawable, x); >- y = DPIUtil.autoScaleUp(drawable, y); >+ x = DPIUtil.autoScaleUp(this.device, drawable, x); >+ y = DPIUtil.autoScaleUp(this.device, drawable, y); > drawImageInPixels(image, x, y); > } > >@@ -980,9 +980,9 @@ > if (image == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); > if (image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); > >- Rectangle src = DPIUtil.autoScaleUp(drawable, new Rectangle(srcX, srcY, srcWidth, srcHeight)); >- Rectangle dest = DPIUtil.autoScaleUp(drawable, new Rectangle(destX, destY, destWidth, destHeight)); >- int deviceZoom = DPIUtil.getDeviceZoom(); >+ Rectangle src = DPIUtil.autoScaleUp(this.device, drawable, new Rectangle(srcX, srcY, srcWidth, srcHeight)); >+ Rectangle dest = DPIUtil.autoScaleUp(this.device, drawable, new Rectangle(destX, destY, destWidth, destHeight)); >+ int deviceZoom = device.getZoom(); > if (deviceZoom != 100) { > /* > * This is a HACK! Due to rounding errors at fractional scale factors, >@@ -1735,10 +1735,10 @@ > * </ul> > */ > public void drawLine (int x1, int y1, int x2, int y2) { >- x1 = DPIUtil.autoScaleUp (drawable, x1); >- x2 = DPIUtil.autoScaleUp (drawable, x2); >- y1 = DPIUtil.autoScaleUp (drawable, y1); >- y2 = DPIUtil.autoScaleUp (drawable, y2); >+ x1 = DPIUtil.autoScaleUp (device, drawable, x1); >+ x2 = DPIUtil.autoScaleUp (device, drawable, x2); >+ y1 = DPIUtil.autoScaleUp (device, drawable, y1); >+ y2 = DPIUtil.autoScaleUp (device, drawable, y2); > drawLineInPixels(x1, y1, x2, y2); > } > >@@ -1792,10 +1792,10 @@ > * </ul> > */ > public void drawOval (int x, int y, int width, int height) { >- x = DPIUtil.autoScaleUp (drawable, x); >- y = DPIUtil.autoScaleUp (drawable, y); >- width = DPIUtil.autoScaleUp (drawable, width); >- height = DPIUtil.autoScaleUp (drawable, height); >+ x = DPIUtil.autoScaleUp (device, drawable, x); >+ y = DPIUtil.autoScaleUp (device, drawable, y); >+ width = DPIUtil.autoScaleUp (device, drawable, width); >+ height = DPIUtil.autoScaleUp (device, drawable, height); > drawOvalInPixels(x, y, width, height); > } > >@@ -1868,8 +1868,8 @@ > * @since 3.0 > */ > public void drawPoint (int x, int y) { >- x = DPIUtil.autoScaleUp (drawable, x); >- y = DPIUtil.autoScaleUp (drawable, y); >+ x = DPIUtil.autoScaleUp (device, drawable, x); >+ y = DPIUtil.autoScaleUp (device, drawable, y); > drawPointInPixels(x, y); > } > >@@ -1902,7 +1902,7 @@ > */ > public void drawPolygon (int[] pointArray) { > if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); >- drawPolygonInPixels(DPIUtil.autoScaleUp(drawable, pointArray)); >+ drawPolygonInPixels(DPIUtil.autoScaleUp(this.device, drawable, pointArray)); > } > > void drawPolygonInPixels(int[] pointArray) { >@@ -1950,7 +1950,7 @@ > * </ul> > */ > public void drawPolyline (int[] pointArray) { >- drawPolylineInPixels(DPIUtil.autoScaleUp(drawable, pointArray)); >+ drawPolylineInPixels(DPIUtil.autoScaleUp(this.device, drawable, pointArray)); > } > > void drawPolylineInPixels(int[] pointArray) { >@@ -2003,10 +2003,10 @@ > * </ul> > */ > public void drawRectangle (int x, int y, int width, int height) { >- x = DPIUtil.autoScaleUp (drawable, x); >- y = DPIUtil.autoScaleUp (drawable, y); >- width = DPIUtil.autoScaleUp (drawable, width); >- height = DPIUtil.autoScaleUp (drawable, height); >+ x = DPIUtil.autoScaleUp (device, drawable, x); >+ y = DPIUtil.autoScaleUp (device, drawable, y); >+ width = DPIUtil.autoScaleUp (device, drawable, width); >+ height = DPIUtil.autoScaleUp (device, drawable, height); > drawRectangleInPixels(x, y, width, height); > } > >@@ -2062,7 +2062,7 @@ > */ > public void drawRectangle (Rectangle rect) { > if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); >- rect = DPIUtil.autoScaleUp(drawable, rect); >+ rect = DPIUtil.autoScaleUp(this.device, drawable, rect); > drawRectangleInPixels(rect.x, rect.y, rect.width, rect.height); > } > >@@ -2088,12 +2088,12 @@ > * </ul> > */ > public void drawRoundRectangle (int x, int y, int width, int height, int arcWidth, int arcHeight) { >- x = DPIUtil.autoScaleUp (drawable, x); >- y = DPIUtil.autoScaleUp (drawable, y); >- width = DPIUtil.autoScaleUp (drawable, width); >- height = DPIUtil.autoScaleUp (drawable, height); >- arcWidth = DPIUtil.autoScaleUp (drawable, arcWidth); >- arcHeight = DPIUtil.autoScaleUp (drawable, arcHeight); >+ x = DPIUtil.autoScaleUp (device, drawable, x); >+ y = DPIUtil.autoScaleUp (device, drawable, y); >+ width = DPIUtil.autoScaleUp (device, drawable, width); >+ height = DPIUtil.autoScaleUp (device, drawable, height); >+ arcWidth = DPIUtil.autoScaleUp (device, drawable, arcWidth); >+ arcHeight = DPIUtil.autoScaleUp (device, drawable, arcHeight); > drawRoundRectangleInPixels(x, y, width, height, arcWidth, arcHeight); > } > >@@ -2221,8 +2221,8 @@ > * </ul> > */ > public void drawString (String string, int x, int y) { >- x = DPIUtil.autoScaleUp(drawable, x); >- y = DPIUtil.autoScaleUp(drawable, y); >+ x = DPIUtil.autoScaleUp(this.device, drawable, x); >+ y = DPIUtil.autoScaleUp(this.device, drawable, y); > drawStringInPixels(string, x, y, false); > } > >@@ -2247,8 +2247,8 @@ > * </ul> > */ > public void drawString (String string, int x, int y, boolean isTransparent) { >- x = DPIUtil.autoScaleUp(drawable, x); >- y = DPIUtil.autoScaleUp(drawable, y); >+ x = DPIUtil.autoScaleUp(this.device, drawable, x); >+ y = DPIUtil.autoScaleUp(this.device, drawable, y); > drawStringInPixels(string, x, y, isTransparent); > } > >@@ -2343,8 +2343,8 @@ > * </ul> > */ > public void drawText (String string, int x, int y) { >- x = DPIUtil.autoScaleUp(drawable, x); >- y = DPIUtil.autoScaleUp(drawable, y); >+ x = DPIUtil.autoScaleUp(this.device, drawable, x); >+ y = DPIUtil.autoScaleUp(this.device, drawable, y); > drawTextInPixels(string, x, y); > } > >@@ -2373,8 +2373,8 @@ > * </ul> > */ > public void drawText (String string, int x, int y, boolean isTransparent) { >- x = DPIUtil.autoScaleUp(drawable, x); >- y = DPIUtil.autoScaleUp(drawable, y); >+ x = DPIUtil.autoScaleUp(this.device, drawable, x); >+ y = DPIUtil.autoScaleUp(this.device, drawable, y); > drawTextInPixels(string, x, y, isTransparent); > } > >@@ -2419,8 +2419,8 @@ > * </ul> > */ > public void drawText (String string, int x, int y, int flags) { >- x = DPIUtil.autoScaleUp(drawable, x); >- y = DPIUtil.autoScaleUp(drawable, y); >+ x = DPIUtil.autoScaleUp(this.device, drawable, x); >+ y = DPIUtil.autoScaleUp(this.device, drawable, y); > drawTextInPixels(string, x, y, flags); > } > >@@ -2820,10 +2820,10 @@ > * @see #drawArc > */ > public void fillArc (int x, int y, int width, int height, int startAngle, int arcAngle) { >- x = DPIUtil.autoScaleUp (drawable, x); >- y = DPIUtil.autoScaleUp (drawable, y); >- width = DPIUtil.autoScaleUp (drawable, width); >- height = DPIUtil.autoScaleUp (drawable, height); >+ x = DPIUtil.autoScaleUp (device, drawable, x); >+ y = DPIUtil.autoScaleUp (device, drawable, y); >+ width = DPIUtil.autoScaleUp (device, drawable, width); >+ height = DPIUtil.autoScaleUp (device, drawable, height); > fillArcInPixels(x, y, width, height, startAngle, arcAngle); > } > >@@ -2929,10 +2929,10 @@ > * @see #drawRectangle(int, int, int, int) > */ > public void fillGradientRectangle (int x, int y, int width, int height, boolean vertical) { >- x = DPIUtil.autoScaleUp (drawable, x); >- y = DPIUtil.autoScaleUp (drawable, y); >- width = DPIUtil.autoScaleUp (drawable, width); >- height = DPIUtil.autoScaleUp (drawable, height); >+ x = DPIUtil.autoScaleUp (device, drawable, x); >+ y = DPIUtil.autoScaleUp (device, drawable, y); >+ width = DPIUtil.autoScaleUp (device, drawable, width); >+ height = DPIUtil.autoScaleUp (device, drawable, height); > fillGradientRectangleInPixels(x, y, width, height, vertical); > } > >@@ -3063,10 +3063,10 @@ > * @see #drawOval > */ > public void fillOval (int x, int y, int width, int height) { >- x = DPIUtil.autoScaleUp (drawable, x); >- y = DPIUtil.autoScaleUp (drawable, y); >- width = DPIUtil.autoScaleUp (drawable, width); >- height = DPIUtil.autoScaleUp (drawable, height); >+ x = DPIUtil.autoScaleUp (device, drawable, x); >+ y = DPIUtil.autoScaleUp (device, drawable, y); >+ width = DPIUtil.autoScaleUp (device, drawable, width); >+ height = DPIUtil.autoScaleUp (device, drawable, height); > fillOvalInPixels(x, y, width, height); > } > >@@ -3136,7 +3136,7 @@ > */ > public void fillPolygon (int[] pointArray) { > if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); >- fillPolygonInPixels(DPIUtil.autoScaleUp(drawable, pointArray)); >+ fillPolygonInPixels(DPIUtil.autoScaleUp(this.device, drawable, pointArray)); > } > > void fillPolygonInPixels (int[] pointArray) { >@@ -3176,10 +3176,10 @@ > * @see #drawRectangle(int, int, int, int) > */ > public void fillRectangle (int x, int y, int width, int height) { >- x = DPIUtil.autoScaleUp (drawable, x); >- y = DPIUtil.autoScaleUp (drawable, y); >- width = DPIUtil.autoScaleUp (drawable, width); >- height = DPIUtil.autoScaleUp (drawable, height); >+ x = DPIUtil.autoScaleUp (device, drawable, x); >+ y = DPIUtil.autoScaleUp (device, drawable, y); >+ width = DPIUtil.autoScaleUp (device, drawable, width); >+ height = DPIUtil.autoScaleUp (device, drawable, height); > fillRectangleInPixels(x, y, width, height); > } > >@@ -3226,7 +3226,7 @@ > */ > public void fillRectangle (Rectangle rect) { > if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); >- rect = DPIUtil.autoScaleUp(drawable, rect); >+ rect = DPIUtil.autoScaleUp(this.device, drawable, rect); > fillRectangleInPixels(rect.x, rect.y, rect.width, rect.height); > } > >@@ -3248,12 +3248,12 @@ > * @see #drawRoundRectangle > */ > public void fillRoundRectangle (int x, int y, int width, int height, int arcWidth, int arcHeight) { >- x = DPIUtil.autoScaleUp (drawable, x); >- y = DPIUtil.autoScaleUp (drawable, y); >- width = DPIUtil.autoScaleUp (drawable, width); >- height = DPIUtil.autoScaleUp (drawable, height); >- arcWidth = DPIUtil.autoScaleUp (drawable, arcWidth); >- arcHeight = DPIUtil.autoScaleUp (drawable, arcHeight); >+ x = DPIUtil.autoScaleUp (device, drawable, x); >+ y = DPIUtil.autoScaleUp (device, drawable, y); >+ width = DPIUtil.autoScaleUp (device, drawable, width); >+ height = DPIUtil.autoScaleUp (device, drawable, height); >+ arcWidth = DPIUtil.autoScaleUp (device, drawable, arcWidth); >+ arcHeight = DPIUtil.autoScaleUp (device, drawable, arcHeight); > fillRoundRectangleInPixels(x, y, width, height, arcWidth, arcHeight); > } > >@@ -3529,7 +3529,7 @@ > * </ul> > */ > public Rectangle getClipping () { >- return DPIUtil.autoScaleDown(drawable, getClippingInPixels()); >+ return DPIUtil.autoScaleDown(this.device, drawable, getClippingInPixels()); > } > > Rectangle getClippingInPixels() { >@@ -3698,7 +3698,7 @@ > checkGC(FONT); > TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW() : new TEXTMETRICA(); > OS.GetTextMetrics(handle, lptm); >- return FontMetrics.win32_new(lptm); >+ return FontMetrics.win32_new(device, lptm); > } > > /** >@@ -3804,7 +3804,7 @@ > */ > public LineAttributes getLineAttributes () { > LineAttributes attributes = getLineAttributesInPixels(); >- attributes.width = DPIUtil.autoScaleDown(drawable, attributes.width); >+ attributes.width = DPIUtil.autoScaleDown(this.device, drawable, attributes.width); > return attributes; > } > >@@ -3906,7 +3906,7 @@ > * </ul> > */ > public int getLineWidth () { >- return DPIUtil.autoScaleDown(drawable, getLineWidthInPixels()); >+ return DPIUtil.autoScaleDown(this.device, drawable, getLineWidthInPixels()); > } > > int getLineWidthInPixels() { >@@ -4470,10 +4470,10 @@ > * </ul> > */ > public void setClipping (int x, int y, int width, int height) { >- x = DPIUtil.autoScaleUp(drawable, x); >- y = DPIUtil.autoScaleUp(drawable, y); >- width = DPIUtil.autoScaleUp(drawable, width); >- height = DPIUtil.autoScaleUp(drawable, height); >+ x = DPIUtil.autoScaleUp(this.device, drawable, x); >+ y = DPIUtil.autoScaleUp(this.device, drawable, y); >+ width = DPIUtil.autoScaleUp(this.device, drawable, width); >+ height = DPIUtil.autoScaleUp(this.device, drawable, height); > setClippingInPixels(x, y, width, height); > } > >@@ -4541,7 +4541,7 @@ > setClipping(0); > } > else { >- rect = DPIUtil.autoScaleUp(drawable, rect); >+ rect = DPIUtil.autoScaleUp(this.device, drawable, rect); > setClippingInPixels(rect.x, rect.y, rect.width, rect.height); > } > } >@@ -4744,7 +4744,7 @@ > */ > public void setLineAttributes (LineAttributes attributes) { > if (attributes == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); >- attributes.width = DPIUtil.autoScaleUp(drawable, attributes.width); >+ attributes.width = DPIUtil.autoScaleUp(this.device, drawable, attributes.width); > setLineAttributesInPixels(attributes); > } > >@@ -4997,7 +4997,7 @@ > * </ul> > */ > public void setLineWidth(int lineWidth) { >- lineWidth = DPIUtil.autoScaleUp (drawable, lineWidth); >+ lineWidth = DPIUtil.autoScaleUp (device, drawable, lineWidth); > setLineWidthInPixels(lineWidth); > } > >@@ -5151,7 +5151,7 @@ > */ > public Point stringExtent (String string) { > if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); >- return DPIUtil.autoScaleDown(drawable, stringExtentInPixels(string)); >+ return DPIUtil.autoScaleDown(this.device, drawable, stringExtentInPixels(string)); > } > > Point stringExtentInPixels (String string) { >@@ -5198,7 +5198,7 @@ > * </ul> > */ > public Point textExtent (String string) { >- return DPIUtil.autoScaleDown(drawable, textExtentInPixels(string, SWT.DRAW_DELIMITER | SWT.DRAW_TAB)); >+ return DPIUtil.autoScaleDown(this.device, drawable, textExtentInPixels(string, SWT.DRAW_DELIMITER | SWT.DRAW_TAB)); > } > > /** >@@ -5233,7 +5233,7 @@ > * </ul> > */ > public Point textExtent (String string, int flags) { >- return DPIUtil.autoScaleDown(drawable, textExtentInPixels(string, flags)); >+ return DPIUtil.autoScaleDown(this.device, drawable, textExtentInPixels(string, flags)); > } > > Point textExtentInPixels(String string, int flags) { >diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java >index 4293a2c..6e921d6 100644 >--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java >+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java >@@ -1999,7 +1999,7 @@ > lptm.tmHeight = DPIUtil.autoScaleUp(getDevice(), ascentInPoints + descentInPoints); > lptm.tmInternalLeading = DPIUtil.autoScaleUp(getDevice(), leadingInPoints); > lptm.tmAveCharWidth = 0; >- return FontMetrics.win32_new(lptm); >+ return FontMetrics.win32_new(device, lptm); > } > > /** >diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Transform.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Transform.java >index 2a26a1b..9315d60 100644 >--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Transform.java >+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Transform.java >@@ -144,7 +144,7 @@ > public Transform (Device device, float m11, float m12, float m21, float m22, float dx, float dy) { > super(device); > this.device.checkGDIP(); >- handle = Gdip.Matrix_new(m11, m12, m21, m22, DPIUtil.autoScaleUp(dx), DPIUtil.autoScaleUp(dy)); >+ handle = Gdip.Matrix_new(m11, m12, m21, m22, DPIUtil.autoScaleUp(device, dx), DPIUtil.autoScaleUp(device, dy)); > if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES); > init(); > } >@@ -180,8 +180,8 @@ > if (elements == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); > if (elements.length < 6) SWT.error(SWT.ERROR_INVALID_ARGUMENT); > Gdip.Matrix_GetElements(handle, elements); >- elements[4] = DPIUtil.autoScaleDown(elements[4]); >- elements[5] = DPIUtil.autoScaleDown(elements[5]); >+ elements[4] = DPIUtil.autoScaleDown(device, elements[4]); >+ elements[5] = DPIUtil.autoScaleDown(device, elements[5]); > } > > /** >@@ -312,7 +312,7 @@ > */ > public void setElements(float m11, float m12, float m21, float m22, float dx, float dy) { > if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); >- Gdip.Matrix_SetElements(handle, m11, m12, m21, m22, DPIUtil.autoScaleUp(dx), DPIUtil.autoScaleUp(dy)); >+ Gdip.Matrix_SetElements(handle, m11, m12, m21, m22, DPIUtil.autoScaleUp(device, dx), DPIUtil.autoScaleUp(device, dy)); > } > > /** >@@ -352,11 +352,11 @@ > if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); > int length = pointArray.length; > for (int i = 0; i < length; i++) { >- pointArray[i] = DPIUtil.autoScaleUp(pointArray[i]); >+ pointArray[i] = DPIUtil.autoScaleUp(device, pointArray[i]); > } > Gdip.Matrix_TransformPoints(handle, pointArray, length / 2); > for (int i = 0; i < length; i++) { >- pointArray[i] = DPIUtil.autoScaleDown(pointArray[i]); >+ pointArray[i] = DPIUtil.autoScaleDown(device, pointArray[i]); > } > } > >@@ -373,7 +373,7 @@ > */ > public void translate(float offsetX, float offsetY) { > if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); >- Gdip.Matrix_Translate(handle, DPIUtil.autoScaleUp(offsetX), DPIUtil.autoScaleUp(offsetY), Gdip.MatrixOrderPrepend); >+ Gdip.Matrix_Translate(handle, DPIUtil.autoScaleUp(device, offsetX), DPIUtil.autoScaleUp(device, offsetY), Gdip.MatrixOrderPrepend); > } > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 480639
: 272273