Chromium Code Reviews| Index: src/gpu/GrLayerCache.h |
| diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h |
| index a957e78013e05e3acabafac6821dfa4cc9cd46d5..c75132a463b83012fe0d68a890721bea4c300048 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,34 @@ 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 |
|
bsalomon
2014/06/24 17:29:59
Maybe should add something to the comment about th
robertphillips
2014/06/24 19:59:43
Done.
|
| + 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 |