Index: src/gpu/GrLayerCache.h |
diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h |
index e66d3330a6f94d6c20fb263ea1397937a5e2456d..8c6872e13dfa42eadcc898015d4165b87a48ad51 100644 |
--- a/src/gpu/GrLayerCache.h |
+++ b/src/gpu/GrLayerCache.h |
@@ -141,10 +141,29 @@ private: |
// The GrLayerCache caches pre-computed saveLayers for later rendering. |
// Non-atlased layers are stored in their own GrTexture while the atlased |
// layers share a single GrTexture. |
-// Unlike the GrFontCache, the GrTexture atlas only has one GrAtlas (for 8888) |
-// and one GrPlot (for the entire atlas). As such, the GrLayerCache |
-// roughly combines the functionality of the GrFontCache and GrTextStrike |
-// classes. |
+// |
+// The Layer Cache uses four plots for atlasing. It attempts to devote a single plot to |
+// each picture but does allow sharing if a particular picture requires more |
+// space. This is accomplished by: |
+// If the picture already has plots |
+// check its current plots for space - if they do return the new location |
+// else (the picture is new or an existing picture which needs more space): |
+// if there is an empty plot devote it to the picture |
+// failing that find the emptiest plot and devote it to the picture |
+// failing that (the atlas is full): |
+// Loop through the plots that aren't currently used by the picture in LRU order |
+// If all the layers are unlocked: |
+// delete them all, clear the rectanizer and devote the plot to the picture |
+// failing that - indicate that the atlas is full |
+// |
+// In order to purge a given picture: |
+// Each plot used by the picture is considered. |
+// If all the layers in the plot are unlocked then they are all removed and |
+// the plot's rectanizer is reset. This can result in some layers owned |
+// by other pictures being ejected! |
+// If not all the layers are unlocked then just the purged picture's layers |
+// are removed and the rectanizer isn't reset. This can lead to a lot |
+// of wasted space in the plot! |
class GrLayerCache { |
public: |
GrLayerCache(GrContext*); |