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
diff --git a/gm/srcmode.cpp b/gm/srcmode.cpp
index 6eba098..c99a6b2 100644
--- a/gm/srcmode.cpp
+++ b/gm/srcmode.cpp
@@ -115,7 +115,8 @@
}
}
- 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 @@
};
#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 @@
}
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);