Skip to content

Commit dc9ed48

Browse files
committed
[Win32] Inline obsolete getScaledImageData() method in Image
The method getScaledImageData() inherited by all image providers is only has two callers. The calls are difficult to understand as potential overwrites of the method and included delegation are not obvious. At the same time, some other code places already contain similar logic inlined. This change thus inlines the method to ease understanding of the calling places.
1 parent 990d506 commit dc9ed48

File tree

1 file changed

+4
-7
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics

1 file changed

+4
-7
lines changed

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,11 +2070,6 @@ protected boolean isPersistentImageHandleRequriedForImageData() {
20702070

20712071
abstract AbstractImageProviderWrapper createCopy(Image image);
20722072

2073-
ImageData getScaledImageData (int zoom) {
2074-
ElementAtZoom<ImageData> closestAvailableImageData = getClosestAvailableImageData(zoom);
2075-
return DPIUtil.scaleImageData(device, closestAvailableImageData.element(), zoom, closestAvailableImageData.zoom());
2076-
}
2077-
20782073
ElementAtZoom<ImageData> getClosestAvailableImageData(int zoom) {
20792074
TreeSet<Integer> availableZooms = new TreeSet<>(imageHandleManager.getAllZooms());
20802075
int closestZoom = Optional.ofNullable(availableZooms.higher(zoom)).orElse(availableZooms.lower(zoom));
@@ -2125,7 +2120,8 @@ protected Rectangle getBounds(int zoom) {
21252120

21262121
@Override
21272122
ImageData newImageData(int zoom) {
2128-
return getScaledImageData(zoom);
2123+
ElementAtZoom<ImageData> closestAvailableImageData = loadImageData(zoom);
2124+
return DPIUtil.scaleImageData(device, closestAvailableImageData.element(), zoom, closestAvailableImageData.zoom());
21292125
}
21302126

21312127
@Override
@@ -2344,7 +2340,8 @@ protected boolean isPersistentImageHandleRequriedForImageData() {
23442340

23452341
@Override
23462342
ImageData newImageData(int zoom) {
2347-
return getScaledImageData(zoom);
2343+
ElementAtZoom<ImageData> closestAvailableImageData = loadImageData(zoom);
2344+
return DPIUtil.scaleImageData(device, closestAvailableImageData.element(), zoom, closestAvailableImageData.zoom());
23482345
}
23492346

23502347
@Override

0 commit comments

Comments
 (0)