Changeset 8289 in josm


Ignore:
Timestamp:
2015-04-28T13:04:18+02:00 (10 years ago)
Author:
bastiK
Message:

fixed #11378 - mapcss: fill-area rescales image

Location:
trunk/src/org/openstreetmap/josm/gui/mappaint
Files:
2 edited

Legend:

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

    r8085 r8289  
    4141        IconReference iconRef = c.get(FILL_IMAGE, null, IconReference.class);
    4242        if (iconRef != null) {
    43             fillImage = new MapImage(iconRef.iconName, iconRef.source);
     43            fillImage = new MapImage(iconRef.iconName, iconRef.source, false);
    4444
    4545            color = new Color(fillImage.getImage(false).getRGB(
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapImage.java

    r8103 r8289  
    3333    public String name;
    3434    public StyleSource source;
     35    public boolean autoRescale;
    3536    public int width = -1;
    3637    public int height = -1;
     
    4243
    4344    public MapImage(String name, StyleSource source) {
     45        this(name, source, true);
     46    }
     47
     48    public MapImage(String name, StyleSource source, boolean autoRescale) {
    4449        this.name = name;
    4550        this.source = source;
     51        this.autoRescale = autoRescale;
    4652    }
    4753
     
    199205
    200206    private boolean mustRescale(Image image) {
    201         return ((width  == -1 && image.getWidth(null) > MAX_SIZE)
    202              && (height == -1 && image.getHeight(null) > MAX_SIZE));
     207        return autoRescale && width  == -1 && image.getWidth(null) > MAX_SIZE
     208             && height == -1 && image.getHeight(null) > MAX_SIZE;
    203209    }
    204210
     
    212218                Objects.equals(name, other.name) &&
    213219                Objects.equals(source, other.source) &&
     220                autoRescale == other.autoRescale &&
    214221                width == other.width &&
    215222                height == other.height;
     
    222229        hash = 67 * hash + name.hashCode();
    223230        hash = 67 * hash + source.hashCode();
     231        hash = 67 * hash + (autoRescale ? 1 : 0);
    224232        hash = 67 * hash + width;
    225233        hash = 67 * hash + height;
Note: See TracChangeset for help on using the changeset viewer.