- Timestamp:
- 2013-11-07T17:03:07+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/MapImage.java
r6291 r6374 19 19 20 20 public class MapImage { 21 22 private static final int MAX_SIZE = 48; 23 21 24 /** 22 25 * ImageIcon can change while the image is loading. … … 117 120 private Rectangle box() { 118 121 int w = getWidth(), h = getHeight(); 122 if (mustRescale(getImage())) { 123 w = h = 16; 124 } 119 125 return new Rectangle(-w/2, -h/2, w, h); 120 126 } … … 158 164 */ 159 165 public Image getDisplayedNodeIcon(boolean disabled) { 160 final int maxSize = 48;161 166 final Image image = disabled ? getDisabled() : getImage(); 162 167 // Scale down large (.svg) images to 16x16 pixels if no size is explicitely specified 163 if ((width == -1 && image.getWidth(null) > maxSize) 164 && (height == -1 && image.getHeight(null) > maxSize)) { 168 if (mustRescale(image)) { 165 169 return ImageProvider.createBoundedImage(image, 16); 166 170 } else { 167 171 return image; 168 172 } 173 } 174 175 private boolean mustRescale(Image image) { 176 return ((width == -1 && image.getWidth(null) > MAX_SIZE) 177 && (height == -1 && image.getHeight(null) > MAX_SIZE)); 169 178 } 170 179
Note:
See TracChangeset
for help on using the changeset viewer.