aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/win
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-05 19:13:09 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-05 19:13:09 +0000
commitb7f20f20ac4d87819789211aec5935ec1b83ffcd (patch)
tree97ecd4fcedfa130ea0f63b15ad1abc8a125bd256 /src/gpu/gl/win
parent77472f06f88b85e85fb690584c85d0a42e74b685 (diff)
Unify wgl context creation.
R=robertphillips@google.com Review URL: https://codereview.chromium.org/12455009 git-svn-id: http://skia.googlecode.com/svn/trunk@7990 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/gl/win')
-rw-r--r--src/gpu/gl/win/SkNativeGLContext_win.cpp56
1 files changed, 2 insertions, 54 deletions
diff --git a/src/gpu/gl/win/SkNativeGLContext_win.cpp b/src/gpu/gl/win/SkNativeGLContext_win.cpp
index 00829207ac..eabc78a9ba 100644
--- a/src/gpu/gl/win/SkNativeGLContext_win.cpp
+++ b/src/gpu/gl/win/SkNativeGLContext_win.cpp
@@ -7,6 +7,7 @@
*/
#include "gl/SkNativeGLContext.h"
+#include "SkWGL.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
@@ -49,35 +50,6 @@ void SkNativeGLContext::destroyGLContext() {
const GrGLInterface* SkNativeGLContext::createGLContext() {
HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL);
- if (!gWC) {
- 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;
-
- gWC = RegisterClass(&wc);
- if (!gWC) {
- SkDebugf("Could not register window class.\n");
- return NULL;
- }
- }
-
- if (!(fWindow = CreateWindow(TEXT("Griffin"),
- TEXT("The Invisible Man"),
- WS_OVERLAPPEDWINDOW,
- 0, 0, 1, 1,
- NULL, NULL,
- hInstance, NULL))) {
- SkDebugf("Could not create window.\n");
- return NULL;
- }
if (!(fDeviceContext = GetDC(fWindow))) {
SkDebugf("Could not get device context.\n");
@@ -85,31 +57,7 @@ const GrGLInterface* SkNativeGLContext::createGLContext() {
return NULL;
}
- PIXELFORMATDESCRIPTOR pfd;
- ZeroMemory(&pfd, sizeof(pfd));
- pfd.nSize = sizeof(pfd);
- pfd.nVersion = 1;
- pfd.dwFlags = PFD_SUPPORT_OPENGL;
- pfd.iPixelType = PFD_TYPE_RGBA;
- pfd.cColorBits = 32;
- pfd.cDepthBits = 0;
- pfd.cStencilBits = 0;
- pfd.iLayerType = PFD_MAIN_PLANE;
-
- int pixelFormat = 0;
- if (!(pixelFormat = ChoosePixelFormat(fDeviceContext, &pfd))) {
- SkDebugf("No matching pixel format descriptor.\n");
- this->destroyGLContext();
- return NULL;
- }
-
- if (!SetPixelFormat(fDeviceContext, pixelFormat, &pfd)) {
- SkDebugf("Could not set the pixel format %d.\n", pixelFormat);
- this->destroyGLContext();
- return NULL;
- }
-
- if (!(fGlRenderContext = wglCreateContext(fDeviceContext))) {
+ if (!(fGlRenderContext = SkCreateWGLContext(fDeviceContext, 0, false))) {
SkDebugf("Could not create rendering context.\n");
this->destroyGLContext();
return NULL;