add SkImageInfo to SkGrPixelRef constructor, to prep for larger CL

BUG=

Review URL: https://codereview.chromium.org/104923011

git-svn-id: http://skia.googlecode.com/svn/trunk@12559 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2013-12-09 13:41:06 +00:00
parent bc451d2823
commit 61867875ef
2 changed files with 19 additions and 1 deletions

View File

@ -47,7 +47,8 @@ public:
* 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);
SkGrPixelRef(GrSurface*, bool transferCacheLock = false);
SkGrPixelRef(const SkImageInfo&, GrSurface*, bool transferCacheLock = false);
virtual ~SkGrPixelRef();
// override from SkPixelRef

View File

@ -117,6 +117,23 @@ SkGrPixelRef::SkGrPixelRef(GrSurface* surface, bool transferCacheLock) {
SkSafeRef(surface);
}
SkGrPixelRef::SkGrPixelRef(const SkImageInfo&, GrSurface* surface, bool transferCacheLock) {
// TODO: figure out if this is responsible for Chrome canvas errors
#if 0
// The GrTexture has a ref to the GrRenderTarget but not vice versa.
// If the GrTexture exists take a ref to that (rather than the render
// target)
fSurface = surface->asTexture();
#else
fSurface = NULL;
#endif
if (NULL == fSurface) {
fSurface = surface;
}
fUnlock = transferCacheLock;
SkSafeRef(surface);
}
SkGrPixelRef::~SkGrPixelRef() {
if (fUnlock) {
GrContext* context = fSurface->getContext();