Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Unified Diff: src/gpu/GrLayerCache.h

Issue 657383004: Alter layer hoisting to only hoist layers for one canvas at a time (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix noGPU build Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkMultiPictureDraw.cpp ('k') | src/gpu/GrLayerCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/core/SkMultiPictureDraw.cpp ('k') | src/gpu/GrLayerCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698