Beispiel #1
0
 /**
  * Copy dirty layer references to array for further painting. The copying is needed to not keep
  * lock on layers list when layers painting will happen. Dirty states of the layers are cleaned
  * after the copying. Layers painting can change layers state again, but it will be served on next
  * repaint only.
  */
 private void copyAndCleanDirtyLayers() {
   if (CGraphicsQ.DEBUG) {
     System.err.println("[Copy dirty layers]");
   }
   CLayer l;
   dirtyCount = 0;
   int layersCount = layers.size();
   // Heuristics to increase array for copied dirty layers
   if (layersCount > dirtyMaxCount) {
     dirtyMaxCount += layersCount;
     dirtyLayers = new CLayer[dirtyMaxCount];
   }
   // Copy dirty layer references and reset dirty layer states
   for (CLayerElement le = layers.getBottom(); le != null; le = le.getUpper()) {
     l = le.getLayer();
     if (l.visible && l.isDirty()) {
       l.copyAndCleanDirtyState();
       dirtyLayers[dirtyCount++] = l;
     } else { // !(visible && dirty)
       if (CGraphicsQ.DEBUG) {
         System.err.println("Skip Layer: " + l);
       }
     } // if
   } // for
 }
Beispiel #2
0
 /**
  * Sets all visible layers to dirty state. The method is needed on system events like screen
  * rotation, when generic layers system is not capabel to properly analyze layers changes, e.g. of
  * move/resize kind. It could be fixed in the future and this method will be out of use.
  */
 public void setAllDirty() {
   synchronized (layers) {
     CLayer l;
     for (CLayerElement le = layers.getBottom(); le != null; le = le.getUpper()) {
       l = le.getLayer();
       if (l.visible) {
         l.addDirtyRegion();
       } // if
     } // for
   } // synchronized
 }