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

Unified Diff: src/gpu/GrContext.cpp

Issue 732713002: Fix ref-cnting bug in GrContext::readRenderTargetPixels (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 3a93404af17832b421c94bc3f8df1ed08cb81a73..886a68a10915f6662749f868c978c812445b2ee1 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1428,6 +1428,8 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target,
return false;
}
+ SkAutoTUnref<GrTexture> tempTexture;
+
// If the src is a texture and we would have to do conversions after read pixels, we instead
// do the conversions by drawing the src to a scratch texture. If we handle any of the
// conversions in the draw we set the corresponding bool to false so that we don't reapply it
@@ -1454,8 +1456,8 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target,
fGpu->fullReadPixelsIsFasterThanPartial()) {
match = kExact_ScratchTexMatch;
}
- SkAutoTUnref<GrTexture> texture(this->refScratchTexture(desc, match));
- if (texture) {
+ tempTexture.reset(this->refScratchTexture(desc, match));
+ if (tempTexture) {
// compute a matrix to perform the draw
SkMatrix textureMatrix;
textureMatrix.setTranslate(SK_Scalar1 *left, SK_Scalar1 *top);
@@ -1488,13 +1490,13 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target,
SkASSERT(fp);
drawState->addColorProcessor(fp);
- drawState->setRenderTarget(texture->asRenderTarget());
+ drawState->setRenderTarget(tempTexture->asRenderTarget());
SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
fDrawBuffer->drawSimpleRect(rect);
// we want to read back from the scratch's origin
left = 0;
top = 0;
- target = texture->asRenderTarget();
+ target = tempTexture->asRenderTarget();
}
this->flushSurfaceWrites(target);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698