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
diff --git a/include/gpu/SkGrPixelRef.h b/include/gpu/SkGrPixelRef.h
index b7eaf0d..4476a84 100644
--- a/include/gpu/SkGrPixelRef.h
+++ b/include/gpu/SkGrPixelRef.h
@@ -42,7 +42,12 @@
*/
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 @@
private:
GrSurface* fSurface;
+ bool fUnlock; // if true the pixel ref owns a texture cache lock on fSurface
+
typedef SkROLockPixelsPixelRef INHERITED;
};