From ae403b94967aa73fe0fd9f0afb612d5773aeafbf Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Wed, 10 Apr 2013 17:27:30 +0000 Subject: [PATCH] Simplify bench pictures render target creation. Author: bsalomon@google.com Reviewed By: robertphillips@google.com Review URL: https://chromiumcodereview.appspot.com/13947016 git-svn-id: http://skia.googlecode.com/svn/trunk@8596 2bbb7eff-a529-9590-31e7-b0007b416f81 --- tools/PictureRenderer.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp index 704642d934..274768b118 100644 --- a/tools/PictureRenderer.cpp +++ b/tools/PictureRenderer.cpp @@ -112,8 +112,7 @@ SkCanvas* PictureRenderer::setupCanvas(int width, int height) { // fall through #endif case kGPU_DeviceType: { - SkAutoTUnref rt; - bool grSuccess = false; + SkAutoTUnref target; if (fGrContext) { // create a render target to back the device GrTextureDesc desc; @@ -122,20 +121,14 @@ SkCanvas* PictureRenderer::setupCanvas(int width, int height) { desc.fWidth = width; desc.fHeight = height; desc.fSampleCnt = 0; - GrTexture* tex = fGrContext->createUncachedTexture(desc, NULL, 0); - if (tex) { - rt.reset(tex->asRenderTarget()); - rt.get()->ref(); - tex->unref(); - grSuccess = NULL != rt.get(); - } + target.reset(fGrContext->createUncachedTexture(desc, NULL, 0)); } - if (!grSuccess) { + if (NULL == target.get()) { SkASSERT(0); return NULL; } - SkAutoTUnref device(SkNEW_ARGS(SkGpuDevice, (fGrContext, rt))); + SkAutoTUnref device(SkGpuDevice::Create(target)); canvas = SkNEW_ARGS(SkCanvas, (device.get())); break; } -- 2.34.1