Make GrGLInterface a per-GrContext refcounted object rather than a global

Review URL: http://codereview.appspot.com/4901046/



git-svn-id: http://skia.googlecode.com/svn/trunk@2140 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrGLUtil.cpp b/gpu/src/GrGLUtil.cpp
index 5a57ac4..5637cf3 100644
--- a/gpu/src/GrGLUtil.cpp
+++ b/gpu/src/GrGLUtil.cpp
@@ -10,14 +10,16 @@
 #include "GrGLConfig.h"
 #include "GrGLInterface.h"
 
-void GrGLClearErr() {
-    while (GR_GL_NO_ERROR != GrGLGetGLInterface()->fGetError()) {}
+void GrGLClearErr(const GrGLInterface* gl) {
+    while (GR_GL_NO_ERROR != gl->fGetError()) {}
 }
 
-void GrGLCheckErr(const char* location, const char* call) {
-    uint32_t err =  GrGLGetGLInterface()->fGetError();
+void GrGLCheckErr(const GrGLInterface* gl,
+                  const char* location,
+                  const char* call) {
+    uint32_t err = GR_GL_GET_ERROR(gl);
     if (GR_GL_NO_ERROR != err) {
-        GrPrintf("---- glGetError %x", err);
+        GrPrintf("---- glGetError %x", GR_GL_GET_ERROR(gl));
         if (NULL != location) {
             GrPrintf(" at\n\t%s", location);
         }
@@ -28,9 +30,9 @@
     }
 }
 
-void GrGLRestoreResetRowLength() {
-    if (GR_GL_SUPPORT_DESKTOP) {
-        GR_GL(PixelStorei(GR_GL_UNPACK_ROW_LENGTH, 0));
+void GrGLResetRowLength(const GrGLInterface* gl) {
+    if (gl->supportsDesktop()) {
+        GR_GL_CALL(gl, PixelStorei(GR_GL_UNPACK_ROW_LENGTH, 0));
     }
 }