Skip to content

Commit ce1b583

Browse files
committed
Refactoring ImageProviders
This commit refactors usage of ImageDataProvider and ImageFilenameProvider to make the code more readable. contributes to #62 and #127
1 parent 8568366 commit ce1b583

File tree

1 file changed

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

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ void destroy () {
11671167

11681168
private void destroyHandle () {
11691169
for (ImageHandle imageMetadata : zoomLevelToImageHandle.values()) {
1170-
destroyHandle(imageMetadata);
1170+
destroyHandle(imageMetadata.handle);
11711171
}
11721172
zoomLevelToImageHandle.clear();
11731173
}
@@ -1177,18 +1177,18 @@ void destroyHandlesExcept(Set<Integer> zoomLevels) {
11771177
zoomLevelToImageHandle.entrySet().removeIf(entry -> {
11781178
final Integer zoom = entry.getKey();
11791179
if (!zoomLevels.contains(zoom) && zoom != DPIUtil.getZoomForAutoscaleProperty(initialNativeZoom)) {
1180-
destroyHandle(entry.getValue());
1180+
destroyHandle(entry.getValue().handle);
11811181
return true;
11821182
}
11831183
return false;
11841184
});
11851185
}
11861186

1187-
private void destroyHandle(ImageHandle imageMetadata) {
1187+
private void destroyHandle(long handle) {
11881188
if (type == SWT.ICON) {
1189-
OS.DestroyIcon (imageMetadata.handle);
1189+
OS.DestroyIcon (handle);
11901190
} else {
1191-
OS.DeleteObject (imageMetadata.handle);
1191+
OS.DeleteObject (handle);
11921192
}
11931193
}
11941194

0 commit comments

Comments
 (0)