From aef73617d1bcede80145a13639668f958a3863d8 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Fri, 16 Nov 2012 13:41:45 +0000 Subject: flag the GM if we're in deferred-canvas mode, to work-around bug trying to get the context from its device. git-svn-id: http://skia.googlecode.com/svn/trunk@6452 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gm/srcmode.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gm/srcmode.cpp') diff --git a/gm/srcmode.cpp b/gm/srcmode.cpp index 6eba098f42..c99a6b2f9d 100644 --- a/gm/srcmode.cpp +++ b/gm/srcmode.cpp @@ -115,7 +115,8 @@ protected: } } - static SkSurface* compat_surface(SkCanvas* canvas, const SkISize& size) { + static SkSurface* compat_surface(SkCanvas* canvas, const SkISize& size, + bool skipGPU) { SkImage::Info info = { size.width(), size.height(), @@ -124,7 +125,7 @@ protected: }; #if SK_SUPPORT_GPU SkDevice* dev = canvas->getDevice(); - if (dev->accessRenderTarget()) { + if (!skipGPU && dev->accessRenderTarget()) { SkGpuDevice* gd = (SkGpuDevice*)dev; GrContext* ctx = gd->context(); return SkSurface::NewRenderTarget(ctx, info, 0); @@ -134,7 +135,8 @@ protected: } virtual void onDraw(SkCanvas* canvas) { - SkAutoTUnref surf(compat_surface(canvas, this->getISize())); + SkAutoTUnref surf(compat_surface(canvas, this->getISize(), + this->isCanvasDeferred())); surf->getCanvas()->drawColor(SK_ColorWHITE); this->drawContent(surf->getCanvas()); surf->draw(canvas, 0, 0, NULL); -- cgit v1.2.3