Changeset 3136 in josm
- Timestamp:
- 2010-03-15T08:14:29+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapView.java
r3128 r3136 181 181 private LinkedList<MapViewPaintable> temporaryLayers = new LinkedList<MapViewPaintable>(); 182 182 183 private BufferedImage nonChangedLayersBuffer; 183 184 private BufferedImage offscreenBuffer; 184 185 // Layers that wasn't changed since last paint … … 486 487 } 487 488 488 Graphics2D tempG = (Graphics2D) g; 489 if (null == offscreenBuffer || offscreenBuffer.getWidth() != getWidth() || offscreenBuffer.getHeight() != getHeight()) { 490 offscreenBuffer = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_3BYTE_BGR); 491 } 492 493 Graphics2D tempG = offscreenBuffer.createGraphics(); 494 tempG.setClip(g.getClip()); 489 495 Bounds box = getLatLonBounds(g.getClipBounds()); 490 496 491 if (!canUseBuffer || offscreenBuffer == null) {492 if (null == offscreenBuffer || offscreenBuffer.getWidth() != getWidth() || offscreenBuffer.getHeight() != getHeight()) {493 offscreenBuffer = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_3BYTE_BGR);494 } 495 Graphics2D g2 = offscreenBuffer.createGraphics();497 if (!canUseBuffer || nonChangedLayersBuffer == null) { 498 if (null == nonChangedLayersBuffer || nonChangedLayersBuffer.getWidth() != getWidth() || nonChangedLayersBuffer.getHeight() != getHeight()) { 499 nonChangedLayersBuffer = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_3BYTE_BGR); 500 } 501 Graphics2D g2 = nonChangedLayersBuffer.createGraphics(); 496 502 g2.setClip(g.getClip()); 497 503 g2.setColor(PaintColors.BACKGROUND.get()); … … 504 510 // Maybe there were more unchanged layers then last time - draw them to buffer 505 511 if (nonChangedLayers.size() != nonChangedLayersCount) { 506 Graphics2D g2 = offscreenBuffer.createGraphics();512 Graphics2D g2 = nonChangedLayersBuffer.createGraphics(); 507 513 g2.setClip(g.getClip()); 508 514 for (int i=nonChangedLayers.size(); i<nonChangedLayersCount; i++) { … … 519 525 paintPreferencesChanged = false; 520 526 521 tempG.drawImage( offscreenBuffer, 0, 0, null);527 tempG.drawImage(nonChangedLayersBuffer, 0, 0, null); 522 528 523 529 for (int i=nonChangedLayersCount; i<visibleLayers.size(); i++) { … … 580 586 } 581 587 588 g.drawImage(offscreenBuffer, 0, 0, null); 582 589 super.paint(g); 583 590 }
Note:
See TracChangeset
for help on using the changeset viewer.