Skip to content

Commit 558b7dc

Browse files
committed
Simplify scaling of ImageData with DPIUtil
1 parent 9f60279 commit 558b7dc

File tree

2 files changed

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

2 files changed

+3
-7
lines changed

bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,6 @@ public static ImageData autoScaleUp (Device device, final ImageData imageData) {
346346
return autoScaleImageData(device, imageData, 100);
347347
}
348348

349-
public static ImageData autoScaleUp (Device device, final ElementAtZoom<ImageData> elementAtZoom) {
350-
return autoScaleImageData(device, elementAtZoom.element(), elementAtZoom.zoom());
351-
}
352-
353349
public static int[] autoScaleUp(int[] pointArray) {
354350
return scaleUp(pointArray, deviceZoom);
355351
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ public Image(Device device, ImageData data) {
363363
super(device);
364364
if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
365365
initialNativeZoom = DPIUtil.getNativeDeviceZoom();
366-
data = DPIUtil.autoScaleUp(device, new ElementAtZoom<>(data, 100));
366+
data = DPIUtil.autoScaleImageData(device, data, 100);
367367
init(data, getZoom());
368368
init();
369369
this.device.registerResourceWithZoomSupport(this);
@@ -471,7 +471,7 @@ public Image(Device device, ImageData source, ImageData mask) {
471471
public Image (Device device, InputStream stream) {
472472
super(device);
473473
initialNativeZoom = DPIUtil.getNativeDeviceZoom();
474-
ImageData data = DPIUtil.autoScaleUp(device, new ElementAtZoom<>(new ImageData (stream), 100));
474+
ImageData data = DPIUtil.autoScaleImageData(device, new ImageData (stream), 100);
475475
init(data, getZoom());
476476
init();
477477
this.device.registerResourceWithZoomSupport(this);
@@ -513,7 +513,7 @@ public Image (Device device, String filename) {
513513
super(device);
514514
if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
515515
initialNativeZoom = DPIUtil.getNativeDeviceZoom();
516-
ImageData data = DPIUtil.autoScaleUp(device, new ElementAtZoom<>(new ImageData (filename), 100));
516+
ImageData data = DPIUtil.autoScaleImageData(device, new ImageData (filename), 100);
517517
init(data, getZoom());
518518
init();
519519
this.device.registerResourceWithZoomSupport(this);

0 commit comments

Comments
 (0)