aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2015-09-01 08:34:28 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-09-01 08:34:28 -0700
commitc9a3706f1ee38c331610ec1e872d9a658566c397 (patch)
treea202dd4d7a9f3d42732483988a8e5a16e13aac36 /src/image
parentdac7005b877c7c1c6f36b6e298133dfc7b85b9c0 (diff)
Limit lifetime of GrDrawContext objects
GrDrawContext's are about to become real allocated objects. This CL sets up the machinery so they won't leak. Review URL: https://codereview.chromium.org/1321353002
Diffstat (limited to 'src/image')
-rw-r--r--src/image/SkImage_Gpu.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 6655e39c17..fdcb87136d 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -254,7 +254,11 @@ SkImage* SkImage::NewFromYUVTexturesCopy(GrContext* ctx , SkYUVColorSpace colorS
const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth),
SkIntToScalar(dstDesc.fHeight));
- GrDrawContext* drawContext = ctx->drawContext();
+ SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext());
+ if (!drawContext) {
+ return nullptr;
+ }
+
drawContext->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, SkMatrix::I(), rect);
ctx->flushSurfaceWrites(dst);
return new SkImage_Gpu(dstDesc.fWidth, dstDesc.fHeight, kNeedNewImageUniqueID,