| 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;
|
|
|