Changeset 11028 in josm for trunk


Ignore:
Timestamp:
2016-09-19T16:36:59+02:00 (8 years ago)
Author:
michael2402
Message:

Clean MapView nonChangedLayers logic: Use sub list instead of looping through it.

File:
1 edited

Legend:

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

    r10975 r11028  
    472472            paintPreferencesChanged = false;
    473473        }
    474         canUseBuffer = canUseBuffer && nonChangedLayers.size() <= nonChangedLayersCount &&
    475         lastViewID == getViewID() && lastClipBounds.contains(g.getClipBounds());
    476         if (canUseBuffer) {
    477             for (int i = 0; i < nonChangedLayers.size(); i++) {
    478                 if (visibleLayers.get(i) != nonChangedLayers.get(i)) {
    479                     canUseBuffer = false;
    480                     break;
    481                 }
    482             }
    483         }
     474        canUseBuffer = canUseBuffer
     475                && nonChangedLayers.size() <= nonChangedLayersCount
     476                && lastViewID == getViewID()
     477                && lastClipBounds.contains(g.getClipBounds())
     478                && nonChangedLayers.equals(visibleLayers.subList(0, nonChangedLayers.size()));
    484479
    485480        if (null == offscreenBuffer || offscreenBuffer.getWidth() != getWidth() || offscreenBuffer.getHeight() != getHeight()) {
     
    516511
    517512        nonChangedLayers.clear();
    518         for (int i = 0; i < nonChangedLayersCount; i++) {
    519             nonChangedLayers.add(visibleLayers.get(i));
    520         }
     513        nonChangedLayers.addAll(visibleLayers.subList(0, nonChangedLayersCount));
    521514        lastViewID = getViewID();
    522515        lastClipBounds = g.getClipBounds();
Note: See TracChangeset for help on using the changeset viewer.