Index: src/gpu/GrLayerCache.h |
diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h |
index adf904f833b4688126ec24805000fb1f2fbe4283..58887d6405c9e6d820c23dba96a498f4ab4a9dc3 100644 |
--- a/src/gpu/GrLayerCache.h |
+++ b/src/gpu/GrLayerCache.h |
@@ -208,10 +208,20 @@ public: |
const SkMatrix& ctm, |
const SkPaint* paint); |
- // Inform the cache that layer's cached image is now required. |
- // Return true if the layer must be re-rendered. Return false if the |
- // layer was found in the cache and can be reused. |
- bool lock(GrCachedLayer* layer, const GrTextureDesc& desc, bool dontAtlas); |
+ // Attempt to place 'layer' in the atlas. Return true on success; false on failure. |
+ // When true is returned, 'needsRendering' will indicate if the layer must be (re)drawn. |
+ // Additionally, the GPU resources will be locked. |
+ bool tryToAtlas(GrCachedLayer* layer, const GrTextureDesc& desc, bool* needsRendering); |
+ |
+ // Attempt to lock the GPU resources required for a layer. Return true on success; |
+ // false on failure. When true is returned 'needsRendering' will indicate if the |
+ // layer must be (re)drawn. |
+ // Note that atlased layers should already have been locked and rendered so only |
+ // free floating layers will have 'needsRendering' set. |
+ // Currently, this path always uses a new scratch texture for non-Atlased layers |
+ // and (thus) doesn't cache anything. This can yield a lot of re-rendering. |
+ // TODO: allow rediscovery of free-floating layers that are still in the resource cache. |
+ bool lock(GrCachedLayer* layer, const GrTextureDesc& desc, bool* needsRendering); |
// addUse is just here to keep the API symmetric |
void addUse(GrCachedLayer* layer) { layer->addUse(); } |
@@ -235,6 +245,10 @@ public: |
void writeLayersToDisk(const SkString& dirName); |
#endif |
+ static bool PlausiblyAtlasable(int width, int height) { |
+ return width <= kPlotWidth && height <= kPlotHeight; |
+ } |
+ |
private: |
static const int kAtlasTextureWidth = 1024; |
static const int kAtlasTextureHeight = 1024; |
@@ -282,10 +296,6 @@ private: |
// Remove all the layers (and unlock any resources) associated with 'pictureID' |
void purge(uint32_t pictureID); |
- static bool PlausiblyAtlasable(int width, int height) { |
- return width <= kPlotWidth && height <= kPlotHeight; |
- } |
- |
void purgePlot(GrPlot* plot); |
// Try to find a purgeable plot and clear it out. Return true if a plot |