aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/srcmode.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-11-16 13:41:45 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-11-16 13:41:45 +0000
commitaef73617d1bcede80145a13639668f958a3863d8 (patch)
tree0cbb50e44983b8b7d6011ff4813dda46903510a4 /gm/srcmode.cpp
parent13201e74f43b9c5fa173339eb36de515370e6973 (diff)
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
Diffstat (limited to 'gm/srcmode.cpp')
-rw-r--r--gm/srcmode.cpp8
1 files changed, 5 insertions, 3 deletions
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<SkSurface> surf(compat_surface(canvas, this->getISize()));
+ SkAutoTUnref<SkSurface> surf(compat_surface(canvas, this->getISize(),
+ this->isCanvasDeferred()));
surf->getCanvas()->drawColor(SK_ColorWHITE);
this->drawContent(surf->getCanvas());
surf->draw(canvas, 0, 0, NULL);