Ticket #685: josm-render-speedup.2.diff
| File josm-render-speedup.2.diff, 2.4 KB (added by , 18 years ago) |
|---|
-
home/dnaber/workspace/JOSM/src/org/openstreetmap/josm/gui/MapView.java
6 6 7 7 import java.awt.Color; 8 8 import java.awt.Graphics; 9 import java.awt.Graphics2D; 9 10 import java.awt.Point; 11 import java.awt.Transparency; 10 12 import java.awt.event.ComponentAdapter; 11 13 import java.awt.event.ComponentEvent; 12 14 import java.awt.event.KeyEvent; 15 import java.awt.image.BufferedImage; 13 16 import java.util.ArrayList; 14 17 import java.util.Collection; 15 18 import java.util.Collections; … … 198 201 @Override public void paint(Graphics g) { 199 202 if (center == null) 200 203 return; // no data loaded yet. 201 g.setColor(Preferences.getPreferencesColor("background", Color.BLACK)); 202 g.fillRect(0, 0, getWidth(), getHeight()); 204 205 BufferedImage bim = new BufferedImage(getWidth(), getHeight(), Transparency.OPAQUE); 206 Graphics2D tempG = bim.createGraphics(); 207 tempG.setColor(Preferences.getPreferencesColor("background", Color.BLACK)); 208 tempG.fillRect(0, 0, getWidth(), getHeight()); 203 209 204 210 for (int i = layers.size()-1; i >= 0; --i) { 205 211 Layer l = layers.get(i); … … 204 210 for (int i = layers.size()-1; i >= 0; --i) { 205 211 Layer l = layers.get(i); 206 212 if (l.visible && l != getActiveLayer()) 207 l.paint( g, this);213 l.paint(tempG, this); 208 214 } 209 215 210 216 if (getActiveLayer() != null && getActiveLayer().visible) 211 getActiveLayer().paint( g, this);217 getActiveLayer().paint(tempG, this); 212 218 213 219 for (MapViewPaintable mvp : temporaryLayers) { 214 mvp.paint( g, this);220 mvp.paint(tempG, this); 215 221 } 216 222 217 223 // draw world borders 218 g.setColor(Color.WHITE);224 tempG.setColor(Color.WHITE); 219 225 Bounds b = new Bounds(); 220 226 Point min = getPoint(getProjection().latlon2eastNorth(b.min)); 221 227 Point max = getPoint(getProjection().latlon2eastNorth(b.max)); … … 224 230 int x2 = Math.max(min.x, max.x); 225 231 int y2 = Math.max(min.y, max.y); 226 232 if (x1 > 0 || y1 > 0 || x2 < getWidth() || y2 < getHeight()) 227 g.drawRect(x1, y1, x2-x1+1, y2-y1+1);233 tempG.drawRect(x1, y1, x2-x1+1, y2-y1+1); 228 234 229 235 if (playHeadMarker != null) 230 playHeadMarker.paint( g, this);236 playHeadMarker.paint(tempG, this); 231 237 238 g.drawImage(bim, 0, 0, null); 232 239 super.paint(g); 233 240 } 234 241
