Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "WindowContextFactory_win.h" | 9 #include "WindowContextFactory_win.h" |
| 10 #include <GL/gl.h> | 10 #include <GL/gl.h> |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 RECT rect; | 89 RECT rect; |
| 90 GetClientRect(fHWND, &rect); | 90 GetClientRect(fHWND, &rect); |
| 91 fWidth = rect.right - rect.left; | 91 fWidth = rect.right - rect.left; |
| 92 fHeight = rect.bottom - rect.top; | 92 fHeight = rect.bottom - rect.top; |
| 93 glViewport(0, 0, fWidth, fHeight); | 93 glViewport(0, 0, fWidth, fHeight); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 | 97 |
| 98 void GLWindowContext_win::onDestroyContext() { | 98 void GLWindowContext_win::onDestroyContext() { |
| 99 wglMakeCurrent(wglGetCurrentDC(), NULL); | 99 HDC dc = GetDC(fHWND); |
|
bsalomon
2016/07/27 20:26:38
Should this be paired with a ReleaseDC? Or do we r
jvanverth1
2016/07/27 20:41:50
Deleted. I added this in to try and figure out why
| |
| 100 wglMakeCurrent(dc, NULL); | |
| 100 wglDeleteContext(fHGLRC); | 101 wglDeleteContext(fHGLRC); |
| 101 fHGLRC = NULL; | 102 fHGLRC = NULL; |
| 102 } | 103 } |
| 103 | 104 |
| 104 | 105 |
| 105 void GLWindowContext_win::onSwapBuffers() { | 106 void GLWindowContext_win::onSwapBuffers() { |
| 106 HDC dc = GetDC((HWND)fHWND); | 107 HDC dc = GetDC((HWND)fHWND); |
| 107 SwapBuffers(dc); | 108 SwapBuffers(dc); |
| 108 ReleaseDC((HWND)fHWND, dc); | 109 ReleaseDC((HWND)fHWND, dc); |
| 109 } | 110 } |
| 110 | 111 |
| 111 | 112 |
| 112 } // anonymous namespace | 113 } // anonymous namespace |
| 113 | 114 |
| 114 namespace sk_app { | 115 namespace sk_app { |
| 115 namespace window_context_factory { | 116 namespace window_context_factory { |
| 116 | 117 |
| 117 WindowContext* NewGLForWin(HWND wnd, const DisplayParams& params) { | 118 WindowContext* NewGLForWin(HWND wnd, const DisplayParams& params) { |
| 118 GLWindowContext_win* ctx = new GLWindowContext_win(wnd, params); | 119 GLWindowContext_win* ctx = new GLWindowContext_win(wnd, params); |
| 119 if (!ctx->isValid()) { | 120 if (!ctx->isValid()) { |
| 120 delete ctx; | 121 delete ctx; |
| 121 return nullptr; | 122 return nullptr; |
| 122 } | 123 } |
| 123 return ctx; | 124 return ctx; |
| 124 } | 125 } |
| 125 | 126 |
| 126 } // namespace window_context_factory | 127 } // namespace window_context_factory |
| 127 } // namespace sk_app | 128 } // namespace sk_app |
| OLD | NEW |