Skip to content

Commit

Permalink
add support for zoom level of program images
Browse files Browse the repository at this point in the history
add support for zoom level of program images
  • Loading branch information
ptief authored and HeikoKlare committed Jan 29, 2024
1 parent 4b0353a commit 04cdd39
Showing 1 changed file with 7 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,29 +62,15 @@ public Image getImage() {
return createImage();
}

/**
* Returns an SWT Image that is described by the information in this descriptor.
* Each call returns a new Image.
*/
@Override
public ImageData getImageData() {
ImageData data = null;
ImageData defaultImage = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE).getImageData();
if (defaultImage == null) {
return null;
public ImageData getImageData(int zoom) {
if (program != null) {
ImageData imageData = program.getImageData(zoom);
if (imageData != null) {
return imageData;
}
}

if (program == null || ((data = program.getImageData()) == null)) {
return defaultImage;
}

// The images in GNOME are too big. Scaling them does not give nice result so
// return defaultImage;
if (data.height > defaultImage.height || data.width > defaultImage.width) {
return defaultImage;
}

return data;
return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE).getImageData(zoom);
}

/**
Expand Down

0 comments on commit 04cdd39

Please sign in to comment.