micro fix for rrects bug using GrDrawContext
authorjoshualitt <joshualitt@chromium.org>
Wed, 13 Jan 2016 19:23:26 +0000 (11:23 -0800)
committerCommit bot <commit-bot@chromium.org>
Wed, 13 Jan 2016 19:23:27 +0000 (11:23 -0800)
TBR=bsalomon@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1582933002

Review URL: https://codereview.chromium.org/1582933002

gm/rrects.cpp

index 8cb737b21cd83eafc3add526c5d179118ecd6274..63d6c9e6dbbf2adb56e8528d291ed53bee96c0b0 100644 (file)
@@ -67,9 +67,17 @@ protected:
 #if SK_SUPPORT_GPU
         GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
         context = rt ? rt->getContext() : nullptr;
-        SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt));
-        if (!drawContext) {
-            return;
+        SkAutoTUnref<GrDrawContext> drawContext;
+        if (kEffect_Type == fType) {
+            if (!context) {
+                skiagm::GM::DrawGpuOnlyMessage(canvas);
+                return;
+            }
+
+            drawContext.reset(context->drawContext(rt));
+            if (!drawContext) {
+                return;
+            }
         }
 #endif
         if (kEffect_Type == fType && nullptr == context) {