Changeset 8510 in josm for trunk/src/org/openstreetmap/josm/data/imagery/GeorefImage.java
- Timestamp:
- 2015-06-20T23:42:21+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/GeorefImage.java
r7425 r8510 37 37 private int yIndex; 38 38 39 private static final Color transparentColor = new Color(0, 0,0,0);39 private static final Color transparentColor = new Color(0, 0, 0, 0); 40 40 private Color fadeColor = transparentColor; 41 41 … … 118 118 return false; 119 119 120 if(!(this.xIndex == xIndex && this.yIndex == yIndex)) 120 if (!(this.xIndex == xIndex && this.yIndex == yIndex)) 121 121 return false; 122 122 … … 130 130 131 131 // This happens if you zoom outside the world 132 if(width == 0 || height == 0) 132 if (width == 0 || height == 0) 133 133 return false; 134 134 … … 141 141 } 142 142 143 BufferedImage img = reImg == null ?null:reImg.get();144 if(img != null && img.getWidth() == width && img.getHeight() == height && fadeColor.equals(newFadeColor)) { 143 BufferedImage img = reImg == null ? null : reImg.get(); 144 if (img != null && img.getWidth() == width && img.getHeight() == height && fadeColor.equals(newFadeColor)) { 145 145 g.drawImage(img, x, y, null); 146 146 return true; … … 152 152 153 153 try { 154 if(img != null) { 154 if (img != null) { 155 155 img.flush(); 156 156 } … … 163 163 // traditional rendering is as fast at these zoom levels, so it's no loss. 164 164 // Also prevent caching if we're out of memory soon 165 if(width > 2000 || height > 2000 || width*height*multipl > freeMem) { 165 if (width > 2000 || height > 2000 || width*height*multipl > freeMem) { 166 166 fallbackDraw(g, getImage(), x, y, width, height, alphaChannel); 167 167 } else { 168 168 // We haven't got a saved resized copy, so resize and cache it 169 img = new BufferedImage(width, height, alphaChannel ?BufferedImage.TYPE_INT_ARGB:BufferedImage.TYPE_3BYTE_BGR);169 img = new BufferedImage(width, height, alphaChannel ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_3BYTE_BGR); 170 170 img.getGraphics().drawImage(getImage(), 171 171 0, 0, width, height, // dest … … 179 179 reImg = new SoftReference<>(img); 180 180 } 181 } catch(Exception e) { 181 } catch (Exception e) { 182 182 fallbackDraw(g, getImage(), x, y, width, height, alphaChannel); 183 183 } … … 216 216 private void writeObject(ObjectOutputStream out) throws IOException { 217 217 out.writeObject(state); 218 if(getImage() == null) { 218 if (getImage() == null) { 219 219 out.writeBoolean(false); 220 220 out.writeObject(null);
Note:
See TracChangeset
for help on using the changeset viewer.
