Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: tools/viewer/sk_app/win/GLWindowContext_win.cpp

Issue 2184163003: Enable backend switching for Windows Viewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Delete extra glMakeCurrent Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/viewer/sk_app/Window.h ('k') | tools/viewer/sk_app/win/Window_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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);
100 wglDeleteContext(fHGLRC); 99 wglDeleteContext(fHGLRC);
101 fHGLRC = NULL; 100 fHGLRC = NULL;
102 } 101 }
103 102
104 103
105 void GLWindowContext_win::onSwapBuffers() { 104 void GLWindowContext_win::onSwapBuffers() {
106 HDC dc = GetDC((HWND)fHWND); 105 HDC dc = GetDC((HWND)fHWND);
107 SwapBuffers(dc); 106 SwapBuffers(dc);
108 ReleaseDC((HWND)fHWND, dc); 107 ReleaseDC((HWND)fHWND, dc);
109 } 108 }
110 109
111 110
112 } // anonymous namespace 111 } // anonymous namespace
113 112
114 namespace sk_app { 113 namespace sk_app {
115 namespace window_context_factory { 114 namespace window_context_factory {
116 115
117 WindowContext* NewGLForWin(HWND wnd, const DisplayParams& params) { 116 WindowContext* NewGLForWin(HWND wnd, const DisplayParams& params) {
118 GLWindowContext_win* ctx = new GLWindowContext_win(wnd, params); 117 GLWindowContext_win* ctx = new GLWindowContext_win(wnd, params);
119 if (!ctx->isValid()) { 118 if (!ctx->isValid()) {
120 delete ctx; 119 delete ctx;
121 return nullptr; 120 return nullptr;
122 } 121 }
123 return ctx; 122 return ctx;
124 } 123 }
125 124
126 } // namespace window_context_factory 125 } // namespace window_context_factory
127 } // namespace sk_app 126 } // namespace sk_app
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/Window.h ('k') | tools/viewer/sk_app/win/Window_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698