Skip to content

Commit

Permalink
Refactoring ImageProviders
Browse files Browse the repository at this point in the history
- Remove class StaticZoomUpdater
  • Loading branch information
fedejeanne committed Dec 19, 2024
1 parent 284cbb8 commit 37314de
Showing 1 changed file with 0 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.eclipse.swt.internal.DPIUtil.*;
import org.eclipse.swt.internal.gdip.*;
import org.eclipse.swt.internal.win32.*;
import org.eclipse.swt.widgets.*;

/**
* Instances of this class are graphics which have been prepared
Expand Down Expand Up @@ -2036,27 +2035,6 @@ public static Image win32_new(Device device, int type, long handle) {
return image;
}

//This class is only used for a workaround and will be removed again
private class StaticZoomUpdater implements AutoCloseable {
private final boolean updateStaticZoom;
private final int currentNativeDeviceZoom;

private StaticZoomUpdater(int targetZoom) {
this.currentNativeDeviceZoom = DPIUtil.getNativeDeviceZoom();
this.updateStaticZoom = this.currentNativeDeviceZoom != targetZoom && device instanceof Display display && display.isRescalingAtRuntime();
if (updateStaticZoom) {
DPIUtil.setDeviceZoom(targetZoom);
}
}

@Override
public void close() {
if (updateStaticZoom) {
DPIUtil.setDeviceZoom(currentNativeDeviceZoom);
}
}
}

private abstract class AbstractImageProviderWrapper {
abstract Object getProvider();
abstract ImageData getImageData(int zoom);
Expand Down

0 comments on commit 37314de

Please sign in to comment.