move utils/SkEGLContext to gpu/SkGLContext, some gpu.gyp cleanup, set eol style LF on all gpu files

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



git-svn-id: http://skia.googlecode.com/svn/trunk@2474 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index a2d2d75..3b2be8d 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -15,7 +15,7 @@
 #include "SkBenchmark.h"
 #include "SkCanvas.h"
 #include "SkColorPriv.h"
-#include "SkEGLContext.h"
+#include "SkGLContext.h"
 #include "SkGpuDevice.h"
 #include "SkGraphics.h"
 #include "SkImageEncoder.h"
@@ -416,8 +416,8 @@
     GrRenderTarget* rt = NULL;
     //Don't do GL when fixed.
 #if !defined(SK_SCALAR_IS_FIXED)
-    SkEGLContext eglContext;
-    if (eglContext.init(1024, 1024)) {
+    SkGLContext glContext;
+    if (glContext.init(1024, 1024)) {
         context = GrContext::CreateGLShaderContext();
         if (NULL != context) {
             GrPlatformSurfaceDesc desc;
@@ -426,7 +426,7 @@
             desc.fWidth = 1024;
             desc.fHeight = 1024;
             desc.fStencilBits = 8;
-            desc.fPlatformRenderTarget = eglContext.getFBOID();
+            desc.fPlatformRenderTarget = glContext.getFBOID();
             desc.fSurfaceType = kRenderTarget_GrPlatformSurfaceType;
             rt = static_cast<GrRenderTarget*>(context->createPlatformSurface(desc));
             if (NULL == rt) {
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index e74b0bc..1f10c5a 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -12,7 +12,7 @@
 #include "SkColorPriv.h"
 #include "SkData.h"
 #include "SkDevice.h"
-#include "SkEGLContext.h"
+#include "SkGLContext.h"
 #include "SkGpuCanvas.h"
 #include "SkGpuDevice.h"
 #include "SkGraphics.h"
@@ -606,9 +606,9 @@
         maxH = SkMax32(size.height(), maxH);
     }
     // setup a GL context for drawing offscreen
-    SkEGLContext eglContext;
+    SkGLContext glContext;
     GrRenderTarget* rt = NULL;
-    if (eglContext.init(maxW, maxH)) {
+    if (glContext.init(maxW, maxH)) {
         gGrContext = GrContext::CreateGLShaderContext();
         if (NULL != gGrContext) {
             GrPlatformSurfaceDesc desc;
@@ -617,7 +617,7 @@
             desc.fWidth = maxW;
             desc.fHeight = maxH;
             desc.fStencilBits = 8;
-            desc.fPlatformRenderTarget = eglContext.getFBOID();
+            desc.fPlatformRenderTarget = glContext.getFBOID();
             desc.fSurfaceType = kRenderTarget_GrPlatformSurfaceType;
             rt = static_cast<GrRenderTarget*>(gGrContext->createPlatformSurface(desc));
             if (NULL == rt) {
diff --git a/gyp/gpu.gyp b/gyp/gpu.gyp
index 83aa525..690258a 100644
--- a/gyp/gpu.gyp
+++ b/gyp/gpu.gyp
@@ -2,6 +2,89 @@
   'includes': [
     'common.gypi',
   ],
+  'target_defaults': {
+    'conditions': [
+      ['skia_os != "win"', {
+        'sources/': [ ['exclude', '_win.(h|cpp)$'],
+        ],
+      }],
+      ['skia_os != "mac"', {
+        'sources/': [ ['exclude', '_mac.(h|cpp)$'],
+        ],
+      }],
+      ['skia_os != "linux"', {
+        'sources/': [ ['exclude', '_unix.(h|cpp)$'],
+        ],
+      }],
+      ['skia_os != "ios"', {
+        'sources/': [ ['exclude', '_iOS.(h|cpp)$'],
+        ],
+      }],
+      ['skia_os != "android"', {
+        'sources/': [ ['exclude', '_android.(h|cpp)$'],
+        ],
+      }],
+      [ 'skia_os == "android"', {
+        'defines': [
+          'GR_ANDROID_BUILD=1',
+        ],
+      }],
+      [ 'skia_os == "mac"', {
+        'defines': [
+          'GR_MAC_BUILD=1',
+        ],
+      }],
+      [ 'skia_os == "linux"', {
+        'defines': [
+          'GR_LINUX_BUILD=1',
+        ],
+      }],
+      [ 'skia_os == "ios"', {
+        'defines': [
+          'GR_IOS_BUILD=1',
+        ],
+      }],
+      [ 'skia_os == "win"', {
+        'defines': [
+          'GR_WIN32_BUILD=1',
+          'GR_GL_FUNCTION_TYPE=__stdcall',
+        ],
+      }],
+    ],
+    'direct_dependent_settings': {
+      'conditions': [
+        [ 'skia_os == "android"', {
+          'defines': [
+            'GR_ANDROID_BUILD=1',
+          ],
+        }],
+        [ 'skia_os == "mac"', {
+          'defines': [
+            'GR_MAC_BUILD=1',
+          ],
+        }],
+        [ 'skia_os == "linux"', {
+          'defines': [
+            'GR_LINUX_BUILD=1',
+          ],
+        }],
+        [ 'skia_os == "ios"', {
+          'defines': [
+            'GR_IOS_BUILD=1',
+          ],
+        }],
+        [ 'skia_os == "win"', {
+          'defines': [
+            'GR_WIN32_BUILD=1',
+            'GR_GL_FUNCTION_TYPE=__stdcall',
+          ],
+        }],
+      ],
+      'include_dirs': [
+        '../include/gpu',
+      ],
+    },
+  },
   'targets': [
     {
       'target_name': 'skgr',
@@ -24,46 +107,19 @@
         '../src/gpu/SkGr.cpp',
         '../src/gpu/SkGrFontScaler.cpp',
         '../src/gpu/SkGrTexturePixelRef.cpp',
+
+        '../src/gpu/mac/SkGLContext_mac.cpp',
+
+        '../src/gpu/win/SkGLContext_win.cpp',
+
+        '../src/gpu/unix/SkGLContext_unix.cpp',
+
+        '../src/gpu/mesa/SkGLContext_mesa.cpp',
       ],
-      'conditions': [
-          [ 'skia_os == "linux"', {
-          'defines': [
-              'GR_LINUX_BUILD=1',
-          ],
-          }],
-          [ 'skia_os == "mac"', {
-          'defines': [
-              'GR_MAC_BUILD=1',
-          ],
-          }],
-          [ 'skia_os == "win"', {
-          'defines': [
-              'GR_WIN32_BUILD=1',
-          ],
-          }],
+      # Removed for now
+      'sources!': [
+        '../src/gpu/mesa/SkGLContext_mesa.cpp',
       ],
-      'direct_dependent_settings': {
-        'conditions': [
-          [ 'skia_os == "linux"', {
-            'defines': [
-              'GR_LINUX_BUILD=1',
-            ],
-          }],
-          [ 'skia_os == "mac"', {
-            'defines': [
-              'GR_MAC_BUILD=1',
-            ],
-          }],
-          [ 'skia_os == "win"', {
-            'defines': [
-              'GR_WIN32_BUILD=1',
-            ],
-          }],
-        ],
-        'include_dirs': [
-          '../include/gpu',
-        ],
-      },
     },
     {
       'target_name': 'gr',
@@ -201,6 +257,7 @@
 
         '../src/gpu/mesa/GrGLDefaultInterface_mesa.cpp',
       ],
+      # Removed for now
       'sources!': [
         '../src/gpu/mesa/GrGLDefaultInterface_mesa.cpp',
       ],
@@ -209,9 +266,6 @@
       ],
       'conditions': [
         [ 'skia_os == "linux"', {
-          'defines': [
-              'GR_LINUX_BUILD=1',
-          ],
           'sources!': [
             '../src/gpu/GrGLDefaultInterface_none.cpp',
           ],
@@ -223,9 +277,6 @@
           },
         }],
         [ 'skia_os == "mac"', {
-          'defines': [
-              'GR_MAC_BUILD=1',
-          ],
           'link_settings': {
             'libraries': [
               '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
@@ -236,53 +287,11 @@
           ],
           }],
         [ 'skia_os == "win"', {
-          'defines': [
-            'GR_WIN32_BUILD=1',
-            'GR_GL_FUNCTION_TYPE=__stdcall',
-          ],
           'sources!': [
             '../src/gpu/GrGLDefaultInterface_none.cpp',
           ],
         }],
-        [ 'skia_os != "win"', {
-          'sources!': [
-            '../src/gpu/win/GrGLDefaultInterface_win.cpp',
-          ],
-        }],
-        [ 'skia_os != "mac"', {
-          'sources!': [
-            '../src/gpu/mac/GrGLDefaultInterface_mac.cpp',
-          ],
-        }],
-        [ 'skia_os != "linux"', {
-          'sources!': [
-            '../src/gpu/unix/GrGLDefaultInterface_unix.cpp',
-          ],
-        }],
       ],
-      'direct_dependent_settings': {
-        'conditions': [
-          [ 'skia_os == "linux"', {
-            'defines': [
-              'GR_LINUX_BUILD=1',
-            ],
-          }],
-          [ 'skia_os == "mac"', {
-            'defines': [
-              'GR_MAC_BUILD=1',
-            ],
-          }],
-          [ 'skia_os == "win"', {
-            'defines': [
-              'GR_WIN32_BUILD=1',
-              'GR_GL_FUNCTION_TYPE=__stdcall',
-            ],
-          }],
-        ],
-        'include_dirs': [
-          '../include/gpu',
-        ],
-      },
     },
   ],
 }
diff --git a/gyp/utils.gyp b/gyp/utils.gyp
index 73a80eb..067671e 100644
--- a/gyp/utils.gyp
+++ b/gyp/utils.gyp
@@ -23,7 +23,6 @@
         '../include/utils/SkCubicInterval.h',
         '../include/utils/SkCullPoints.h',
         '../include/utils/SkDumpCanvas.h',
-        '../include/utils/SkEGLContext.h',
         '../include/utils/SkGLCanvas.h',
         '../include/utils/SkInterpolator.h',
         '../include/utils/SkLayer.h',
@@ -45,7 +44,6 @@
         '../src/utils/SkCubicInterval.cpp',
         '../src/utils/SkCullPoints.cpp',
         '../src/utils/SkDumpCanvas.cpp',
-        '../src/utils/SkEGLContext_none.cpp',
         '../src/utils/SkInterpolator.cpp',
         '../src/utils/SkLayer.cpp',
         '../src/utils/SkMatrix44.cpp',
@@ -63,17 +61,12 @@
         #mac
         '../include/utils/mac/SkCGUtils.h',
         '../src/utils/mac/SkCreateCGImageRef.cpp',
-        '../src/utils/mac/SkEGLContext_mac.cpp',
-
-        #mesa
-        '../src/utils/mesa/SkEGLContext_Mesa.cpp',
 
         #sdl
         '../src/utils/SDL/SkOSWindow_SDL.cpp',
 
         #*nix
         '../src/utils/unix/keysym2ucs.c',
-        '../src/utils/unix/SkEGLContext_Unix.cpp',
         '../src/utils/unix/SkOSWindow_Unix.cpp',
         
         #windows
@@ -83,20 +76,15 @@
         '../include/utils/win/SkTScopedComPtr.h',
         '../src/utils/win/SkAutoCoInitialize.cpp',
         '../src/utils/win/skia_win.cpp',
-        '../src/utils/win/SkEGLContext_Win.cpp',
         '../src/utils/win/SkHRESULT.cpp',
         '../src/utils/win/SkIStream.cpp',
         '../src/utils/win/SkOSWindow_Win.cpp',
       ],
       'sources!': [
-          '../src/utils/mesa/SkEGLContext_Mesa.cpp',
           '../src/utils/SDL/SkOSWindow_SDL.cpp',
       ],
       'conditions': [
         [ 'skia_os == "mac"', {
-          'sources!': [
-            '../src/utils/SkEGLContext_none.cpp',
-          ],
           'link_settings': {
             'libraries': [
               '$(SDKROOT)/System/Library/Frameworks/AGL.framework',
@@ -114,15 +102,11 @@
           'sources!': [
             '../include/utils/mac/SkCGUtils.h',
             '../src/utils/mac/SkCreateCGImageRef.cpp',
-            '../src/utils/mac/SkEGLContext_mac.cpp',
             '../src/utils/mac/skia_mac.mm',
             '../src/utils/mac/SkOSWindow_Mac.mm',
           ],
         }],
         [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', {
-          'sources!': [
-            '../src/utils/SkEGLContext_none.cpp',
-          ],
           'link_settings': {
             'libraries': [
               '-lGL',
@@ -135,14 +119,10 @@
           ],
           'sources!': [
             '../src/utils/unix/keysym2ucs.c',
-            '../src/utils/unix/SkEGLContext_Unix.cpp',
             '../src/utils/unix/SkOSWindow_Unix.cpp',
           ],
         }],
         [ 'skia_os == "win"', {
-          'sources!': [
-            '../src/utils/SkEGLContext_none.cpp',
-          ],
           'direct_dependent_settings': {
             'include_dirs': [
               '../include/utils/win',
@@ -159,7 +139,6 @@
             '../include/utils/win/SkTScopedComPtr.h',
             '../src/utils/win/SkAutoCoInitialize.cpp',
             '../src/utils/win/skia_win.cpp',
-            '../src/utils/win/SkEGLContext_Win.cpp',
             '../src/utils/win/SkHRESULT.cpp',
             '../src/utils/win/SkIStream.cpp',
             '../src/utils/win/SkOSWindow_Win.cpp',
diff --git a/include/utils/SkEGLContext.h b/include/gpu/SkGLContext.h
similarity index 89%
rename from include/utils/SkEGLContext.h
rename to include/gpu/SkGLContext.h
index 7188ffb..2e8a8ab 100644
--- a/include/utils/SkEGLContext.h
+++ b/include/gpu/SkGLContext.h
@@ -5,8 +5,8 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
-#ifndef SkEGLContext_DEFINED
-#define SkEGLContext_DEFINED
+#ifndef SkGLContext_DEFINED
+#define SkGLContext_DEFINED
 
 #if defined(SK_MESA)
     #include "GL/osmesa.h"
@@ -25,10 +25,10 @@
 /**
  *  Create an offscreen opengl context with an RGBA8 / 8bit stencil FBO.
  */
-class SkEGLContext {
+class SkGLContext {
 public:
-    SkEGLContext();
-    ~SkEGLContext();
+    SkGLContext();
+    ~SkGLContext();
 
     bool init(const int width, const int height);
 
diff --git a/src/gpu/SkGLContext_none.cpp b/src/gpu/SkGLContext_none.cpp
new file mode 100644
index 0000000..921f583
--- /dev/null
+++ b/src/gpu/SkGLContext_none.cpp
@@ -0,0 +1,19 @@
+
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include "SkGLContext.h"
+
+SkGLContext::SkGLContext()
+    : fFBO(0) {
+}
+
+SkGLContext::~SkGLContext() {
+}
+
+bool SkGLContext::init(int width, int height) {
+    return false;
+}
diff --git a/src/utils/mac/SkEGLContext_mac.cpp b/src/gpu/mac/SkGLContext_mac.cpp
similarity index 93%
rename from src/utils/mac/SkEGLContext_mac.cpp
rename to src/gpu/mac/SkGLContext_mac.cpp
index bb96840..0992be8 100644
--- a/src/utils/mac/SkEGLContext_mac.cpp
+++ b/src/gpu/mac/SkGLContext_mac.cpp
@@ -5,22 +5,22 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
-#include "SkEGLContext.h"
+#include "SkGLContext.h"
 //#include "SkTypes.h"
 #include <AGL/agl.h>
 
-SkEGLContext::SkEGLContext() 
+SkGLContext::SkGLContext() 
     : fFBO(0)
     , context(NULL) {
 }
 
-SkEGLContext::~SkEGLContext() {
+SkGLContext::~SkGLContext() {
     if (this->context) {
         aglDestroyContext(this->context);
     }
 }
 
-bool SkEGLContext::init(int width, int height) {
+bool SkGLContext::init(int width, int height) {
     GLint major, minor;
     AGLContext ctx;
 
diff --git a/src/utils/mesa/SkEGLContext_Mesa.cpp b/src/gpu/mesa/SkGLContext_mesa.cpp
similarity index 96%
rename from src/utils/mesa/SkEGLContext_Mesa.cpp
rename to src/gpu/mesa/SkGLContext_mesa.cpp
index 1174ded..6ba42e7 100644
--- a/src/utils/mesa/SkEGLContext_Mesa.cpp
+++ b/src/gpu/mesa/SkGLContext_mesa.cpp
@@ -5,7 +5,7 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
-#include "SkEGLContext.h"
+#include "SkGLContext.h"
 #include "SkTypes.h"
 
 #include "GL/osmesa.h"
@@ -15,13 +15,13 @@
 #define SK_GL_GET_PROC(T, F) F ## _func = (T)OSMesaGetProcAddress(#F);
 #define SK_GL_GET_EXT_PROC(T, F) F ## _func = (T)OSMesaGetProcAddress(#F "EXT");
 
-SkEGLContext::SkEGLContext()
+SkGLContext::SkGLContext()
     : fFBO(0)
     , context(NULL)
     , image(NULL) {
 }
 
-SkEGLContext::~SkEGLContext() {
+SkGLContext::~SkGLContext() {
     if (this->image)
         free(this->image);
     
@@ -46,7 +46,7 @@
     #define SK_OSMESA_COLOR_ORDER OSMESA_RGBA
 #endif
 
-bool SkEGLContext::init(const int width, const int height) {
+bool SkGLContext::init(const int width, const int height) {
     /* Create an RGBA-mode context */
 #if OSMESA_MAJOR_VERSION * 100 + OSMESA_MINOR_VERSION >= 305
     /* specify Z, stencil, accum sizes */
diff --git a/src/utils/unix/SkEGLContext_Unix.cpp b/src/gpu/unix/SkGLContext_unix.cpp
similarity index 97%
rename from src/utils/unix/SkEGLContext_Unix.cpp
rename to src/gpu/unix/SkGLContext_unix.cpp
index 40a1b5d..ea15a4b 100644
--- a/src/utils/unix/SkEGLContext_Unix.cpp
+++ b/src/gpu/unix/SkGLContext_unix.cpp
@@ -5,7 +5,7 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
-#include "SkEGLContext.h"
+#include "SkGLContext.h"
 #include "SkTypes.h"
 
 #include <GL/gl.h>
@@ -23,7 +23,7 @@
     return 0;
 }
 
-SkEGLContext::SkEGLContext() 
+SkGLContext::SkGLContext() 
     : fFBO(0)
     , context(NULL)
     , display(NULL)
@@ -31,7 +31,7 @@
     , glxPixmap(0) {
 }
 
-SkEGLContext::~SkEGLContext() {
+SkGLContext::~SkGLContext() {
     if (this->display) {
         glXMakeCurrent(this->display, 0, 0);
 
@@ -48,7 +48,7 @@
     }
 }
 
-bool SkEGLContext::init(const int width, const int height) {
+bool SkGLContext::init(const int width, const int height) {
     Display *display = XOpenDisplay(0);
     this->display = display;
 
diff --git a/src/gpu/win/SkGLContext_win.cpp b/src/gpu/win/SkGLContext_win.cpp
new file mode 100644
index 0000000..dc24af3
--- /dev/null
+++ b/src/gpu/win/SkGLContext_win.cpp
@@ -0,0 +1,202 @@
+
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#define WIN32_LEAN_AND_MEAN 1
+#include <Windows.h>
+#include <GL/GL.h>
+
+#include "SkGLContext.h"
+#include "SkTypes.h"
+
+#define SK_GL_DECLARE_PROC(F) SkGL ## F ## Proc SkGL ## F = NULL;
+#define SK_GL_GET_PROC(F) SkGL ## F = (SkGL ## F ## Proc) \
+        wglGetProcAddress("gl" #F);
+#define SK_GL_GET_PROC_SUFFIX(F, S) SkGL ## F = (SkGL ## F ## Proc) \
+        wglGetProcAddress("gl" #F #S);
+
+#define SK_GL_FRAMEBUFFER 0x8D40
+#define SK_GL_RENDERBUFFER 0x8D41
+#define SK_GL_COLOR_ATTACHMENT0 0x8CE0
+#define SK_GL_DEPTH_STENCIL 0x84F9
+#define SK_GL_DEPTH_STENCIL_ATTACHMENT 0x821A
+#define SK_GL_FRAMEBUFFER_COMPLETE 0x8CD5
+
+#define SK_GL_FUNCTION_TYPE __stdcall
+typedef void (SK_GL_FUNCTION_TYPE *SkGLGenFramebuffersProc) (GLsizei n, GLuint *framebuffers);
+typedef void (SK_GL_FUNCTION_TYPE *SkGLBindFramebufferProc) (GLenum target, GLuint framebuffer);
+typedef void (SK_GL_FUNCTION_TYPE *SkGLGenRenderbuffersProc) (GLsizei n, GLuint *renderbuffers);
+typedef void (SK_GL_FUNCTION_TYPE *SkGLBindRenderbufferProc) (GLenum target, GLuint renderbuffer);
+typedef void (SK_GL_FUNCTION_TYPE *SkGLRenderbufferStorageProc) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (SK_GL_FUNCTION_TYPE *SkGLFramebufferRenderbufferProc) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef GLenum (SK_GL_FUNCTION_TYPE *SkGLCheckFramebufferStatusProc) (GLenum target);
+
+SkGLContext::SkGLContext()
+        : fFBO(0)
+        , fWindow(NULL)
+        , fDeviceContext(NULL)
+        , fGlRenderContext(0) {
+}
+
+SkGLContext::~SkGLContext() {
+    if (this->fGlRenderContext) {
+        wglDeleteContext(this->fGlRenderContext);
+    }
+    if (this->fWindow && this->fDeviceContext) {
+        ReleaseDC(this->fWindow, this->fDeviceContext);
+    }
+    if (this->fWindow) {
+        DestroyWindow(this->fWindow);
+    }
+}
+
+bool skGLCheckExtension(const char* ext,
+                         const char* extensionString) {
+    int extLength = strlen(ext);
+
+    while (true) {
+        int n = strcspn(extensionString, " ");
+        if (n == extLength && 0 == strncmp(ext, extensionString, n)) {
+            return true;
+        }
+        if (0 == extensionString[n]) {
+            return false;
+        }
+        extensionString += n+1;
+    }
+
+    return false;
+}
+
+bool SkGLContext::init(const int width, const int height) {
+    HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL);
+
+    WNDCLASS wc;
+    wc.cbClsExtra = 0;
+    wc.cbWndExtra = 0;
+    wc.hbrBackground = NULL;
+    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+    wc.hInstance = hInstance;
+    wc.lpfnWndProc = (WNDPROC) DefWindowProc;
+    wc.lpszClassName = TEXT("Griffin");
+    wc.lpszMenuName = NULL;
+    wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
+ 
+    if (!RegisterClass(&wc)) {
+        SkDebugf("Could not register window class.\n");
+        return false;
+    }
+
+    if (!(
+        this->fWindow = CreateWindow(
+        TEXT("Griffin"),
+        TEXT("The Invisible Man"),
+        WS_OVERLAPPEDWINDOW,
+        10, 10,                 // x, y
+        200, 200,               // width, height
+        NULL, NULL,             // parent, menu
+        hInstance, NULL)        // hInstance, param
+        ))
+    {
+        SkDebugf("Could not create window.\n");
+        return false;
+    }
+
+    if (!(this->fDeviceContext = GetDC(this->fWindow))) {
+        SkDebugf("Could not get device context.\n");
+        return false;
+    }
+    
+    PIXELFORMATDESCRIPTOR pfd;
+    ZeroMemory(&pfd, sizeof(pfd));
+    pfd.nSize = sizeof(pfd);
+    pfd.nVersion = 1;
+    pfd.dwFlags = PFD_DRAW_TO_WINDOW |
+                  PFD_SUPPORT_OPENGL |
+                  PFD_DOUBLEBUFFER;
+    pfd.iPixelType = PFD_TYPE_RGBA;
+    pfd.cColorBits = 32;
+    pfd.cDepthBits = 24;
+    pfd.cStencilBits = 8;
+    pfd.iLayerType = PFD_MAIN_PLANE;
+    
+    int pixelFormat = 0;
+    if (!(pixelFormat = ChoosePixelFormat(this->fDeviceContext, &pfd))) {
+	    SkDebugf("No matching pixel format descriptor.\n");
+        return false;
+    }
+    
+    if (!SetPixelFormat(this->fDeviceContext, pixelFormat, &pfd)) {
+	    SkDebugf("Could not set the pixel format %d.\n", pixelFormat);
+        return false;
+    }
+    
+    if (!(this->fGlRenderContext = wglCreateContext(this->fDeviceContext))) {
+	    SkDebugf("Could not create rendering context.\n");
+        return false;
+    }
+
+    if (!(wglMakeCurrent(this->fDeviceContext, this->fGlRenderContext))) {
+        SkDebugf("Could not set the context.\n");
+        return false;
+    }
+
+    //TODO: in the future we need to use this context
+    // to test for WGL_ARB_create_context
+    // and then create a new window / context.
+
+    //Setup the framebuffers
+    const char* glExts =
+        reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS));
+    if (!skGLCheckExtension(
+          "GL_EXT_framebuffer_object"
+          , glExts))
+    {
+        SkDebugf("GL_EXT_framebuffer_object not found.\n");
+        return false;
+    }
+    SK_GL_DECLARE_PROC(GenFramebuffers)
+    SK_GL_DECLARE_PROC(BindFramebuffer)
+    SK_GL_DECLARE_PROC(GenRenderbuffers)
+    SK_GL_DECLARE_PROC(BindRenderbuffer)
+    SK_GL_DECLARE_PROC(RenderbufferStorage)
+    SK_GL_DECLARE_PROC(FramebufferRenderbuffer)
+    SK_GL_DECLARE_PROC(CheckFramebufferStatus)
+
+    SK_GL_GET_PROC_SUFFIX(GenFramebuffers, EXT)
+    SK_GL_GET_PROC_SUFFIX(BindFramebuffer, EXT)
+    SK_GL_GET_PROC_SUFFIX(GenRenderbuffers, EXT)
+    SK_GL_GET_PROC_SUFFIX(BindRenderbuffer, EXT)
+    SK_GL_GET_PROC_SUFFIX(RenderbufferStorage, EXT)
+    SK_GL_GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT)
+    SK_GL_GET_PROC_SUFFIX(CheckFramebufferStatus, EXT)
+
+    GLuint cbID;
+    GLuint dsID;
+    SkGLGenFramebuffers(1, &fFBO);
+    SkGLBindFramebuffer(SK_GL_FRAMEBUFFER, fFBO);
+    SkGLGenRenderbuffers(1, &cbID);
+    SkGLBindRenderbuffer(SK_GL_RENDERBUFFER, cbID);
+    SkGLRenderbufferStorage(SK_GL_RENDERBUFFER, GL_RGBA, width, height);
+    SkGLFramebufferRenderbuffer(SK_GL_FRAMEBUFFER
+                                , SK_GL_COLOR_ATTACHMENT0
+                                , SK_GL_RENDERBUFFER, cbID);
+    SkGLGenRenderbuffers(1, &dsID);
+    SkGLBindRenderbuffer(SK_GL_RENDERBUFFER, dsID);
+    SkGLRenderbufferStorage(SK_GL_RENDERBUFFER, SK_GL_DEPTH_STENCIL
+                             , width, height);
+    SkGLFramebufferRenderbuffer(SK_GL_FRAMEBUFFER
+                                 , SK_GL_DEPTH_STENCIL_ATTACHMENT
+                                 , SK_GL_RENDERBUFFER
+                                 , dsID);
+    glViewport(0, 0, width, height);
+    glClearStencil(0);
+    glClear(GL_STENCIL_BUFFER_BIT);
+
+    GLenum status = SkGLCheckFramebufferStatus(SK_GL_FRAMEBUFFER);
+    return SK_GL_FRAMEBUFFER_COMPLETE == status;
+}
diff --git a/src/utils/SkEGLContext_none.cpp b/src/utils/SkEGLContext_none.cpp
deleted file mode 100644
index 52ea5ef..0000000
--- a/src/utils/SkEGLContext_none.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "SkEGLContext.h"
-
-SkEGLContext::SkEGLContext()
-    : fFBO(0) {
-}
-
-SkEGLContext::~SkEGLContext() {
-}
-
-bool SkEGLContext::init(int width, int height) {
-    return false;
-}
diff --git a/src/utils/win/SkEGLContext_Win.cpp b/src/utils/win/SkEGLContext_Win.cpp
deleted file mode 100644
index b82e7d7..0000000
--- a/src/utils/win/SkEGLContext_Win.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#define WIN32_LEAN_AND_MEAN 1
-#include <Windows.h>
-#include <GL/GL.h>
-
-#include "SkEGLContext.h"
-#include "SkTypes.h"
-
-#define SK_EGL_DECLARE_PROC(F) SkEGL ## F ## Proc SkEGL ## F = NULL;
-#define SK_EGL_GET_PROC(F) SkEGL ## F = (SkEGL ## F ## Proc) \
-        wglGetProcAddress("gl" #F);
-#define SK_EGL_GET_PROC_SUFFIX(F, S) SkEGL ## F = (SkEGL ## F ## Proc) \
-        wglGetProcAddress("gl" #F #S);
-
-#define SK_EGL_FRAMEBUFFER 0x8D40
-#define SK_EGL_RENDERBUFFER 0x8D41
-#define SK_EGL_COLOR_ATTACHMENT0 0x8CE0
-#define SK_EGL_DEPTH_STENCIL 0x84F9
-#define SK_EGL_DEPTH_STENCIL_ATTACHMENT 0x821A
-#define SK_EGL_FRAMEBUFFER_COMPLETE 0x8CD5
-
-#define SK_EGL_FUNCTION_TYPE __stdcall
-typedef void (SK_EGL_FUNCTION_TYPE *SkEGLGenFramebuffersProc) (GLsizei n, GLuint *framebuffers);
-typedef void (SK_EGL_FUNCTION_TYPE *SkEGLBindFramebufferProc) (GLenum target, GLuint framebuffer);
-typedef void (SK_EGL_FUNCTION_TYPE *SkEGLGenRenderbuffersProc) (GLsizei n, GLuint *renderbuffers);
-typedef void (SK_EGL_FUNCTION_TYPE *SkEGLBindRenderbufferProc) (GLenum target, GLuint renderbuffer);
-typedef void (SK_EGL_FUNCTION_TYPE *SkEGLRenderbufferStorageProc) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (SK_EGL_FUNCTION_TYPE *SkEGLFramebufferRenderbufferProc) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef GLenum (SK_EGL_FUNCTION_TYPE *SkEGLCheckFramebufferStatusProc) (GLenum target);
-
-SkEGLContext::SkEGLContext()
-        : fFBO(0)
-        , fWindow(NULL)
-        , fDeviceContext(NULL)
-        , fGlRenderContext(0) {
-}
-
-SkEGLContext::~SkEGLContext() {
-    if (this->fGlRenderContext) {
-        wglDeleteContext(this->fGlRenderContext);
-    }
-    if (this->fWindow && this->fDeviceContext) {
-        ReleaseDC(this->fWindow, this->fDeviceContext);
-    }
-    if (this->fWindow) {
-        DestroyWindow(this->fWindow);
-    }
-}
-
-bool skEGLCheckExtension(const char* ext,
-                         const char* extensionString) {
-    int extLength = strlen(ext);
-
-    while (true) {
-        int n = strcspn(extensionString, " ");
-        if (n == extLength && 0 == strncmp(ext, extensionString, n)) {
-            return true;
-        }
-        if (0 == extensionString[n]) {
-            return false;
-        }
-        extensionString += n+1;
-    }
-
-    return false;
-}
-
-bool SkEGLContext::init(const int width, const int height) {
-    HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL);
-
-    WNDCLASS wc;
-    wc.cbClsExtra = 0;
-    wc.cbWndExtra = 0;
-    wc.hbrBackground = NULL;
-    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
-    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
-    wc.hInstance = hInstance;
-    wc.lpfnWndProc = (WNDPROC) DefWindowProc;
-    wc.lpszClassName = TEXT("Griffin");
-    wc.lpszMenuName = NULL;
-    wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
- 
-    if (!RegisterClass(&wc)) {
-        SkDebugf("Could not register window class.\n");
-        return false;
-    }
-
-    if (!(
-        this->fWindow = CreateWindow(
-        TEXT("Griffin"),
-        TEXT("The Invisible Man"),
-        WS_OVERLAPPEDWINDOW,
-        10, 10,                 // x, y
-        200, 200,               // width, height
-        NULL, NULL,             // parent, menu
-        hInstance, NULL)        // hInstance, param
-        ))
-    {
-        SkDebugf("Could not create window.\n");
-        return false;
-    }
-
-    if (!(this->fDeviceContext = GetDC(this->fWindow))) {
-        SkDebugf("Could not get device context.\n");
-        return false;
-    }
-    
-    PIXELFORMATDESCRIPTOR pfd;
-    ZeroMemory(&pfd, sizeof(pfd));
-    pfd.nSize = sizeof(pfd);
-    pfd.nVersion = 1;
-    pfd.dwFlags = PFD_DRAW_TO_WINDOW |
-                  PFD_SUPPORT_OPENGL |
-                  PFD_DOUBLEBUFFER;
-    pfd.iPixelType = PFD_TYPE_RGBA;
-    pfd.cColorBits = 32;
-    pfd.cDepthBits = 24;
-    pfd.cStencilBits = 8;
-    pfd.iLayerType = PFD_MAIN_PLANE;
-    
-    int pixelFormat = 0;
-    if (!(pixelFormat = ChoosePixelFormat(this->fDeviceContext, &pfd))) {
-	    SkDebugf("No matching pixel format descriptor.\n");
-        return false;
-    }
-    
-    if (!SetPixelFormat(this->fDeviceContext, pixelFormat, &pfd)) {
-	    SkDebugf("Could not set the pixel format %d.\n", pixelFormat);
-        return false;
-    }
-    
-    if (!(this->fGlRenderContext = wglCreateContext(this->fDeviceContext))) {
-	    SkDebugf("Could not create rendering context.\n");
-        return false;
-    }
-
-    if (!(wglMakeCurrent(this->fDeviceContext, this->fGlRenderContext))) {
-        SkDebugf("Could not set the context.\n");
-        return false;
-    }
-
-    //TODO: in the future we need to use this context
-    // to test for WGL_ARB_create_context
-    // and then create a new window / context.
-
-    //Setup the framebuffers
-    const char* glExts =
-        reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS));
-    if (!skEGLCheckExtension(
-          "GL_EXT_framebuffer_object"
-          , glExts))
-    {
-        SkDebugf("GL_EXT_framebuffer_object not found.\n");
-        return false;
-    }
-    SK_EGL_DECLARE_PROC(GenFramebuffers)
-    SK_EGL_DECLARE_PROC(BindFramebuffer)
-    SK_EGL_DECLARE_PROC(GenRenderbuffers)
-    SK_EGL_DECLARE_PROC(BindRenderbuffer)
-    SK_EGL_DECLARE_PROC(RenderbufferStorage)
-    SK_EGL_DECLARE_PROC(FramebufferRenderbuffer)
-    SK_EGL_DECLARE_PROC(CheckFramebufferStatus)
-
-    SK_EGL_GET_PROC_SUFFIX(GenFramebuffers, EXT)
-    SK_EGL_GET_PROC_SUFFIX(BindFramebuffer, EXT)
-    SK_EGL_GET_PROC_SUFFIX(GenRenderbuffers, EXT)
-    SK_EGL_GET_PROC_SUFFIX(BindRenderbuffer, EXT)
-    SK_EGL_GET_PROC_SUFFIX(RenderbufferStorage, EXT)
-    SK_EGL_GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT)
-    SK_EGL_GET_PROC_SUFFIX(CheckFramebufferStatus, EXT)
-
-    GLuint cbID;
-    GLuint dsID;
-    SkEGLGenFramebuffers(1, &fFBO);
-    SkEGLBindFramebuffer(SK_EGL_FRAMEBUFFER, fFBO);
-    SkEGLGenRenderbuffers(1, &cbID);
-    SkEGLBindRenderbuffer(SK_EGL_RENDERBUFFER, cbID);
-    SkEGLRenderbufferStorage(SK_EGL_RENDERBUFFER, GL_RGBA, width, height);
-    SkEGLFramebufferRenderbuffer(SK_EGL_FRAMEBUFFER
-                                 , SK_EGL_COLOR_ATTACHMENT0
-                                 , SK_EGL_RENDERBUFFER, cbID);
-    SkEGLGenRenderbuffers(1, &dsID);
-    SkEGLBindRenderbuffer(SK_EGL_RENDERBUFFER, dsID);
-    SkEGLRenderbufferStorage(SK_EGL_RENDERBUFFER, SK_EGL_DEPTH_STENCIL
-                             , width, height);
-    SkEGLFramebufferRenderbuffer(SK_EGL_FRAMEBUFFER
-                                 , SK_EGL_DEPTH_STENCIL_ATTACHMENT
-                                 , SK_EGL_RENDERBUFFER
-                                 , dsID);
-    glViewport(0, 0, width, height);
-    glClearStencil(0);
-    glClear(GL_STENCIL_BUFFER_BIT);
-
-    GLenum status = SkEGLCheckFramebufferStatus(SK_EGL_FRAMEBUFFER);
-    return SK_EGL_FRAMEBUFFER_COMPLETE == status;
-}
diff --git a/tests/Test.cpp b/tests/Test.cpp
index e8a16f4..55d884d 100644
--- a/tests/Test.cpp
+++ b/tests/Test.cpp
@@ -8,7 +8,7 @@
 #include "Test.h"
 
 #include "GrContext.h"
-#include "SkEGLContext.h"
+#include "SkGLContext.h"
 #include "SkTLazy.h"
 
 using namespace skiatest;
@@ -79,12 +79,12 @@
 
 GrContext* GpuTest::GetContext() {
     // preserve this order, we want gGrContext destroyed after gEGLContext
-    static SkTLazy<SkEGLContext> gEGLContext;
+    static SkTLazy<SkGLContext> gGLContext;
     static SkAutoTUnref<GrContext> gGrContext;
 
     if (NULL == gGrContext.get()) {
-        gEGLContext.init();
-        if (gEGLContext.get()->init(800, 600)) {
+        gGLContext.init();
+        if (gGLContext.get()->init(800, 600)) {
             gGrContext.reset(GrContext::Create(kOpenGL_Shaders_GrEngine, NULL));
         }
     }
diff --git a/tests/Test.h b/tests/Test.h
index 2c28b00..8728040 100644
--- a/tests/Test.h
+++ b/tests/Test.h
@@ -13,7 +13,7 @@
 #include "SkTRegistry.h"
 
 class GrContext;
-class SkEGLContext;
+class SkGLContext;
 
 namespace skiatest {