diff options
author | 2012-08-28 15:07:11 +0000 | |
---|---|---|
committer | 2012-08-28 15:07:11 +0000 | |
commit | 8090e651fc1055e0a36f5f17c851faafda949b2c (patch) | |
tree | ed5a34024ae5a260f174e7891be3a0b8963e14a8 /include | |
parent | 5ee3f67ce35f19f6e5ef44b67db62e964f77d69d (diff) |
Make the SkGrPixelRef be responsible for unlocking device's scratch texture in the cache
Review URL: https://codereview.appspot.com/6498046/
git-svn-id: http://skia.googlecode.com/svn/trunk@5313 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/SkGpuDevice.h | 4 | ||||
-rw-r--r-- | include/gpu/SkGrPixelRef.h | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h index f04be622f1..49eea26573 100644 --- a/include/gpu/SkGpuDevice.h +++ b/include/gpu/SkGpuDevice.h @@ -132,14 +132,12 @@ private: GrClipData fClipData; // state for our offscreen render-target - // TODO: remove 'fCached' and automatically return to the cache - bool fCached; // is fRenderTarget->asTexture() in the cache GrRenderTarget* fRenderTarget; bool fNeedClear; bool fNeedPrepareRenderTarget; // called from rt and tex cons - void initFromRenderTarget(GrContext*, GrRenderTarget*); + void initFromRenderTarget(GrContext*, GrRenderTarget*, bool cached); // used by createCompatibleDevice SkGpuDevice(GrContext*, GrTexture* texture, bool needClear); diff --git a/include/gpu/SkGrPixelRef.h b/include/gpu/SkGrPixelRef.h index b7eaf0d11a..4476a84a6f 100644 --- a/include/gpu/SkGrPixelRef.h +++ b/include/gpu/SkGrPixelRef.h @@ -42,7 +42,12 @@ private: */ class SK_API SkGrPixelRef : public SkROLockPixelsPixelRef { public: - SkGrPixelRef(GrSurface* surface); + /** + * Constructs a pixel ref around a GrSurface. If the caller has locked the GrSurface in the + * cache and would like the pixel ref to unlock it in its destructor then transferCacheLock + * should be set to true. + */ + SkGrPixelRef(GrSurface* surface, bool transferCacheLock = false); virtual ~SkGrPixelRef(); // override from SkPixelRef @@ -57,6 +62,8 @@ protected: private: GrSurface* fSurface; + bool fUnlock; // if true the pixel ref owns a texture cache lock on fSurface + typedef SkROLockPixelsPixelRef INHERITED; }; |