OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #include "SkTypes.h" | 7 #include "SkTypes.h" |
8 | 8 |
9 #if defined(SK_BUILD_FOR_WIN) | 9 #if defined(SK_BUILD_FOR_WIN) |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "gl/GrGLInterface.h" | 24 #include "gl/GrGLInterface.h" |
25 #include "GLES2/gl2.h" | 25 #include "GLES2/gl2.h" |
26 #include <EGL/egl.h> | 26 #include <EGL/egl.h> |
27 #include <EGL/eglext.h> | 27 #include <EGL/eglext.h> |
28 #endif // SK_ANGLE | 28 #endif // SK_ANGLE |
29 | 29 |
30 #if SK_COMMAND_BUFFER | 30 #if SK_COMMAND_BUFFER |
31 #include "gl/command_buffer/SkCommandBufferGLContext.h" | 31 #include "gl/command_buffer/SkCommandBufferGLContext.h" |
32 #endif // SK_COMMAND_BUFFER | 32 #endif // SK_COMMAND_BUFFER |
33 | 33 |
| 34 const int kDefaultWindowWidth = 500; |
| 35 const int kDefaultWindowHeight = 500; |
| 36 |
34 #define GL_CALL(IFACE, X) \ | 37 #define GL_CALL(IFACE, X) \ |
35 SkASSERT(IFACE); \ | 38 SkASSERT(IFACE); \ |
36 do { \ | 39 do { \ |
37 (IFACE)->fFunctions.f##X; \ | 40 (IFACE)->fFunctions.f##X; \ |
38 } while (false) | 41 } while (false) |
39 | 42 |
40 #define WM_EVENT_CALLBACK (WM_USER+0) | 43 #define WM_EVENT_CALLBACK (WM_USER+0) |
41 | 44 |
42 void post_skwinevent(HWND hwnd) | 45 void post_skwinevent(HWND hwnd) |
43 { | 46 { |
44 PostMessage(hwnd, WM_EVENT_CALLBACK, 0, 0); | 47 PostMessage(hwnd, WM_EVENT_CALLBACK, 0, 0); |
45 } | 48 } |
46 | 49 |
47 SkTHashMap<void*, SkOSWindow*> SkOSWindow::gHwndToOSWindowMap; | 50 SkTHashMap<void*, SkOSWindow*> SkOSWindow::gHwndToOSWindowMap; |
48 | 51 |
49 SkOSWindow::SkOSWindow(const void* winInit) { | 52 SkOSWindow::SkOSWindow(const void* winInit) { |
50 fWinInit = *(const WindowInit*)winInit; | 53 fWinInit = *(const WindowInit*)winInit; |
51 | 54 |
52 fHWND = CreateWindow(fWinInit.fClass, NULL, WS_OVERLAPPEDWINDOW, | 55 fHWND = CreateWindow(fWinInit.fClass, NULL, WS_OVERLAPPEDWINDOW, |
53 CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, fWinIni
t.fInstance, NULL); | 56 CW_USEDEFAULT, 0, kDefaultWindowWidth, kDefaultWindowHe
ight, NULL, NULL, |
| 57 fWinInit.fInstance, NULL); |
54 gHwndToOSWindowMap.set(fHWND, this); | 58 gHwndToOSWindowMap.set(fHWND, this); |
55 #if SK_SUPPORT_GPU | 59 #if SK_SUPPORT_GPU |
56 #if SK_ANGLE | 60 #if SK_ANGLE |
57 fDisplay = EGL_NO_DISPLAY; | 61 fDisplay = EGL_NO_DISPLAY; |
58 fContext = EGL_NO_CONTEXT; | 62 fContext = EGL_NO_CONTEXT; |
59 fSurface = EGL_NO_SURFACE; | 63 fSurface = EGL_NO_SURFACE; |
60 #endif | 64 #endif |
61 #if SK_COMMAND_BUFFER | 65 #if SK_COMMAND_BUFFER |
62 fCommandBuffer = nullptr; | 66 fCommandBuffer = nullptr; |
63 #endif // SK_COMMAND_BUFFER | 67 #endif // SK_COMMAND_BUFFER |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 } | 826 } |
823 | 827 |
824 void SkOSWindow::closeWindow() { | 828 void SkOSWindow::closeWindow() { |
825 DestroyWindow((HWND)fHWND); | 829 DestroyWindow((HWND)fHWND); |
826 if (fFullscreen) { | 830 if (fFullscreen) { |
827 DestroyWindow((HWND)fSavedWindowState.fHWND); | 831 DestroyWindow((HWND)fSavedWindowState.fHWND); |
828 } | 832 } |
829 gHwndToOSWindowMap.remove(fHWND); | 833 gHwndToOSWindowMap.remove(fHWND); |
830 } | 834 } |
831 #endif | 835 #endif |
OLD | NEW |