Ignore:
Timestamp:
2016-06-12T12:00:38+02:00 (4 years ago)
Author:
stoecker
Message:

see #9995 - improve handling for HIDPI screens, patch by strump (modified by me)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java

    r10294 r10358  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.awt.Image;
    7 import java.awt.image.BufferedImage;
    86import java.io.File;
    97import java.io.FileInputStream;
     
    7775    public String iconPath;
    7876    /** The plugin icon. */
    79     public ImageIcon icon;
     77    private ImageProvider icon;
    8078    /** Plugin can be loaded at any time and not just at start. */
    8179    public boolean canloadatruntime;
     
    8482    /** All manifest attributes. */
    8583    public final Map<String, String> attr = new TreeMap<>();
    86 
    87     private static final ImageIcon emptyIcon = new ImageIcon(new BufferedImage(24, 24, BufferedImage.TYPE_INT_ARGB));
     84    /** Empty icon for these plugins which have none */
     85    private static final ImageIcon emptyIcon = ImageProvider.getEmpty(ImageProvider.ImageSizes.LARGEICON);
    8886
    8987    /**
     
    244242            if (file != null) {
    245243                // extract icon from the plugin jar file
    246                 icon = new ImageProvider(iconPath).setArchive(file).setMaxWidth(24).setMaxHeight(24).setOptional(true).get();
     244                icon = new ImageProvider(iconPath).setArchive(file).setMaxSize(ImageProvider.ImageSizes.LARGEICON).setOptional(true);
    247245            } else if (iconPath.startsWith("data:")) {
    248                 icon = new ImageProvider(iconPath).setMaxWidth(24).setMaxHeight(24).setOptional(true).get();
     246                icon = new ImageProvider(iconPath).setMaxSize(ImageProvider.ImageSizes.LARGEICON).setOptional(true);
    249247            }
    250248        }
     
    494492
    495493    /**
    496      * Replies the plugin icon, scaled to 24x24 pixels.
    497      * @return the plugin icon, scaled to 24x24 pixels.
     494     * Replies the plugin icon, scaled to LARGE_ICON size.
     495     * @return the plugin icon, scaled to LARGE_ICON size.
    498496     */
    499497    public ImageIcon getScaledIcon() {
    500         if (icon == null)
     498        ImageIcon img = (icon != null) ? icon.get() : null;
     499        if (img == null)
    501500            return emptyIcon;
    502         return new ImageIcon(icon.getImage().getScaledInstance(24, 24, Image.SCALE_SMOOTH));
     501        return img;
    503502    }
    504503
Note: See TracChangeset for help on using the changeset viewer.