aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-07-28 15:39:45 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-28 15:39:45 -0700
commita52b7a03c61e38cff4236cc83eff97f00e465803 (patch)
tree8d79f5a5e50bbd1709c84c8d440e872be88aeabf /src
parentf0674516cb18f6b13e34f404ff5793d9b9ebb56c (diff)
Don't read from unref'ed RT in GrContext::readSurfacePixels
BUG=chromium:514716 TBR=robertphillips@google.com Review URL: https://codereview.chromium.org/1258673009
Diffstat (limited to 'src')
-rwxr-xr-xsrc/gpu/GrContext.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 9077bc0d05..6b7f552895 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -484,7 +484,7 @@ bool GrContext::readSurfacePixels(GrSurface* src,
return false;
}
- GrRenderTarget* rtToRead = src->asRenderTarget();
+ SkAutoTUnref<GrRenderTarget> rtToRead(SkSafeRef(src->asRenderTarget()));
bool didTempDraw = false;
if (GrGpu::kNoDraw_DrawPreference != drawPreference) {
GrTextureProvider::ScratchTexMatch match = GrTextureProvider::kApprox_ScratchTexMatch;
@@ -496,7 +496,8 @@ bool GrContext::readSurfacePixels(GrSurface* src,
}
}
SkAutoTUnref<GrTexture> temp;
- temp.reset(this->textureProvider()->refScratchTexture(tempDrawInfo.fTempSurfaceDesc, match));
+ temp.reset(this->textureProvider()->refScratchTexture(tempDrawInfo.fTempSurfaceDesc,
+ match));
if (temp) {
SkMatrix textureMatrix;
textureMatrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top));
@@ -526,7 +527,7 @@ bool GrContext::readSurfacePixels(GrSurface* src,
GrDrawContext* drawContext = this->drawContext();
drawContext->drawRect(temp->asRenderTarget(), GrClip::WideOpen(), paint,
SkMatrix::I(), rect, NULL);
- rtToRead = temp->asRenderTarget();
+ rtToRead.reset(SkRef(temp->asRenderTarget()));
left = 0;
top = 0;
didTempDraw = true;