Changeset 9281 in josm


Ignore:
Timestamp:
2016-01-03T16:51:43+01:00 (9 years ago)
Author:
stoecker
Message:

fix #10684 - fix SVG upscaling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/ImageResource.java

    r9252 r9281  
    160160        float realWidth;
    161161        float realHeight;
     162        int maxWidth = maxSize.width;
     163        int maxHeight = maxSize.height;
    162164        if (svg != null) {
    163165            realWidth = svg.getWidth();
    164166            realHeight = svg.getHeight();
    165             /* extend small images to the possible maximum, may get reduced later again */
    166             if (maxSize.width != -1 && realWidth < maxSize.width) {
    167                 realHeight *= maxSize.width/realWidth;
    168                 realWidth = maxSize.width;
    169             }
    170             if (maxSize.height != -1 && realHeight < maxSize.height) {
    171                 realWidth *= maxSize.height/realHeight;
    172                 realHeight = maxSize.height;
    173             }
    174167        } else {
    175168            if (baseImage == null) throw new AssertionError();
     
    177170            realWidth = icon.getIconWidth();
    178171            realHeight = icon.getIconHeight();
     172            if (realWidth <= maxWidth) {
     173                maxWidth = -1;
     174            }
     175            if (realHeight <= maxHeight) {
     176                maxHeight = -1;
     177            }
    179178        }
    180         int maxWidth = maxSize.width;
    181         int maxHeight = maxSize.height;
    182 
    183         if (realWidth <= maxWidth) {
    184             maxWidth = -1;
    185         }
    186         if (realHeight <= maxHeight) {
    187             maxHeight = -1;
    188         }
    189 
     179       
    190180        if (maxWidth == -1 && maxHeight == -1)
    191181            return getImageIcon(DEFAULT_DIMENSION);
Note: See TracChangeset for help on using the changeset viewer.