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

Unified Diff: tools/viewer/sk_app/win/Window_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, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/viewer/sk_app/win/Window_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/viewer/sk_app/win/Window_win.cpp
diff --git a/tools/viewer/sk_app/win/Window_win.cpp b/tools/viewer/sk_app/win/Window_win.cpp
index e9905d42cced451cb57b867e7ab15dbcdf89742c..478c81f1d47df39f4e0fd7b8f31ddd31db4ec071 100644
--- a/tools/viewer/sk_app/win/Window_win.cpp
+++ b/tools/viewer/sk_app/win/Window_win.cpp
@@ -33,29 +33,34 @@ Window* Window::CreateNativeWindow(void* platformData) {
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+
bool Window_win::init(HINSTANCE hInstance) {
fHInstance = hInstance ? hInstance : GetModuleHandle(nullptr);
- WNDCLASSEX wcex;
// The main window class name
static const TCHAR gSZWindowClass[] = _T("SkiaApp");
- wcex.cbSize = sizeof(WNDCLASSEX);
-
- wcex.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
- wcex.lpfnWndProc = WndProc;
- wcex.cbClsExtra = 0;
- wcex.cbWndExtra = 0;
- wcex.hInstance = fHInstance;
- wcex.hIcon = LoadIcon(fHInstance, (LPCTSTR)IDI_WINLOGO);
- wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);;
- wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
- wcex.lpszMenuName = nullptr;
- wcex.lpszClassName = gSZWindowClass;
- wcex.hIconSm = LoadIcon(fHInstance, (LPCTSTR)IDI_WINLOGO);;
-
- if (!RegisterClassEx(&wcex)) {
- return false;
+ static WNDCLASSEX wcex;
+ static bool wcexInit = false;
+ if (!wcexInit) {
+ wcex.cbSize = sizeof(WNDCLASSEX);
+
+ wcex.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
+ wcex.lpfnWndProc = WndProc;
+ wcex.cbClsExtra = 0;
+ wcex.cbWndExtra = 0;
+ wcex.hInstance = fHInstance;
+ wcex.hIcon = LoadIcon(fHInstance, (LPCTSTR)IDI_WINLOGO);
+ wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);;
+ wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
+ wcex.lpszMenuName = nullptr;
+ wcex.lpszClassName = gSZWindowClass;
+ wcex.hIconSm = LoadIcon(fHInstance, (LPCTSTR)IDI_WINLOGO);;
+
+ if (!RegisterClassEx(&wcex)) {
+ return false;
+ }
+ wcexInit = true;
}
/*
@@ -175,7 +180,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_CLOSE:
- case WM_DESTROY:
PostQuitMessage(0);
eventHandled = true;
break;
« no previous file with comments | « tools/viewer/sk_app/win/Window_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698