Ignore:
Timestamp:
2020-10-10T18:41:23+02:00 (4 years ago)
Author:
simon04
Message:

fix #19751 - MapImage.rescale: use original SVG instead of rastered version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java

    r16252 r17144  
    190190                    img = noIcon == null ? null : noIcon.getImage();
    191191                } else {
    192                     img = rescale(result.getImageIcon(new Dimension(width, height)).getImage());
     192                    img = result.getImageIcon(new Dimension(width, height)).getImage();
     193                    if (img != null && mustRescale(img)) {
     194                        // Scale down large images to 16x16 pixels if no size is explicitly specified
     195                        img = result.getImageIconBounded(ImageProvider.ImageSizes.MAP.getImageDimension()).getImage();
     196                    }
    193197                }
    194198                if (temporary) {
     
    301305    }
    302306
    303     /**
    304      * Rescale excessively large images.
    305      * @param image the unscaled image
    306      * @return The scaled down version to 16x16 pixels if the image height and width exceeds 48 pixels and no size has been explicitly specified
    307      */
    308     private Image rescale(Image image) {
    309         if (image == null) return null;
    310         // Scale down large (.svg) images to 16x16 pixels if no size is explicitly specified
    311         if (mustRescale(image)) {
    312             return ImageProvider.createBoundedImage(image, 16);
    313         } else {
    314             return image;
    315         }
    316     }
    317 
    318307    private boolean mustRescale(Image image) {
    319308        return autoRescale && width == -1 && image.getWidth(null) > MAX_SIZE
Note: See TracChangeset for help on using the changeset viewer.