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

Unified Diff: src/gpu/GrLayerCache.h

Issue 350183006: Move allocation of texture from SkGpuDevice to GrLayerCache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review comments Created 6 years, 6 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/gpu/GrContext.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 a957e78013e05e3acabafac6821dfa4cc9cd46d5..d06b748ae8fdb4d91cb41331141a8442e245f787 100644
--- a/src/gpu/GrLayerCache.h
+++ b/src/gpu/GrLayerCache.h
@@ -9,13 +9,12 @@
#define GrLayerCache_DEFINED
#include "GrAllocPool.h"
+#include "GrAtlas.h"
#include "GrTHashTable.h"
#include "GrPictureUtils.h"
#include "GrRect.h"
-class GrAtlasMgr;
class GrGpu;
-class GrPlot;
class SkPicture;
// GrAtlasLocation captures an atlased item's position in the atlas. This
@@ -97,24 +96,36 @@ private:
// classes.
class GrLayerCache {
public:
- GrLayerCache(GrGpu*);
+ GrLayerCache(GrContext*);
~GrLayerCache();
+ // As a cache, the GrLayerCache can be ordered to free up all its cached
+ // elements by the GrContext
void freeAll();
- GrCachedLayer* findLayerOrCreate(const SkPicture* picture, int id);
+ GrCachedLayer* findLayer(const SkPicture* picture, int layerID);
+ GrCachedLayer* findLayerOrCreate(const SkPicture* picture, int layerID);
+
+ // Inform the cache that layer's cached image is now required. Return true
+ // if it was found in the ResourceCache and doesn't need to be regenerated.
+ // If false is returned the caller should (re)render the layer into the
+ // newly acquired texture.
+ bool lock(GrCachedLayer* layer, const GrTextureDesc& desc);
+
+ // Inform the cache that layer's cached image is not currently required
+ void unlock(GrCachedLayer* layer);
private:
- SkAutoTUnref<GrGpu> fGpu;
+ GrContext* fContext; // pointer back to owning context
SkAutoTDelete<GrAtlasMgr> fAtlasMgr; // TODO: could lazily allocate
+ GrAtlas fPlotUsage;
class PictureLayerKey;
GrTHashTable<GrCachedLayer, PictureLayerKey, 7> fLayerHash;
GrTAllocPool<GrCachedLayer> fLayerPool;
void init();
- GrCachedLayer* createLayer(const SkPicture* picture, int id);
-
+ GrCachedLayer* createLayer(const SkPicture* picture, int layerID);
};
#endif
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrLayerCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698