Have GMs read the GrContext via a setter/getter rather than a global.

GetGr's current global state makes things rather tricky to run GPU GMs in
parallel (DM).  This API change will let me feed the right GrContext to the
right GM in DM.

I'm not planning on changing the status quo in GM-the-tool: the new getters and
setters still just return the same global.

BUG=skia:1590
R=bsalomon@google.com, robertphillips@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@11306 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/gm.h b/gm/gm.h
index 6cd97b5..2886f8c 100644
--- a/gm/gm.h
+++ b/gm/gm.h
@@ -16,6 +16,10 @@
 #include "SkString.h"
 #include "SkTRegistry.h"
 
+#if SK_SUPPORT_GPU
+#include "GrContext.h"
+#endif
+
 #define DEF_GM(code) \
     static skiagm::GM*          SK_MACRO_APPEND_LINE(F_)(void*) { code; } \
     static skiagm::GMRegistry   SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_));
@@ -93,6 +97,10 @@
             fCanvasIsDeferred = isDeferred;
         }
 
+#if SK_SUPPORT_GPU
+        static GrContext* GetGr(/*very nearly const*/ SkCanvas*);
+#endif
+
     protected:
         static SkString gResourcePath;