Add a mechanism for GMs to silently exclude themselves from Gold

This is useful, for example, when trying to test a hardware feature
that isn't supported in the current context.

Bug: skia:8731
Change-Id: I9a363159300c92e4039bfd05400238c27002efb1
Reviewed-on: https://skia-review.googlesource.com/c/189133
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/gm/copyTo4444.cpp b/gm/copyTo4444.cpp
index 46b034f..194a30a 100644
--- a/gm/copyTo4444.cpp
+++ b/gm/copyTo4444.cpp
@@ -30,18 +30,18 @@
         return SkISize::Make(360, 180);
     }
 
-    virtual void onDraw(SkCanvas* canvas) {
+    DrawResult onDraw(SkCanvas* canvas, SkString* errorMsg) {
         SkBitmap bm, bm4444;
         if (!GetResourceAsBitmap("images/dog.jpg", &bm)) {
-            DrawFailureMessage(canvas, "Could not decode the file. "
-                                       "Did you forget to set the resourcePath?");
-            return;
+            *errorMsg = "Could not decode the file. Did you forget to set the resourcePath?";
+            return DrawResult::kFail;
         }
         canvas->drawBitmap(bm, 0, 0);
 
         // This should dither or we will see artifacts in the background of the image.
         SkAssertResult(sk_tool_utils::copy_to(&bm4444, kARGB_4444_SkColorType, bm));
         canvas->drawBitmap(bm4444, SkIntToScalar(bm.width()), 0);
+        return DrawResult::kOk;
     }
 
 private: