OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 | 7 |
8 #include "Window_win.h" | 8 #include "Window_win.h" |
9 | 9 |
10 #include <tchar.h> | 10 #include <tchar.h> |
11 #include <windows.h> | 11 #include <windows.h> |
12 #include <windowsx.h> | 12 #include <windowsx.h> |
13 | 13 |
14 #include "SkUtils.h" | 14 #include "SkUtils.h" |
15 #include "../GLWindowContext.h" | 15 #include "../GLWindowContext.h" |
16 #ifdef SK_VULKAN | |
17 #include "../VulkanWindowContext.h" | 16 #include "../VulkanWindowContext.h" |
18 #endif | |
19 | 17 |
20 namespace sk_app { | 18 namespace sk_app { |
21 | 19 |
22 Window* Window::CreateNativeWindow(void* platformData) { | 20 Window* Window::CreateNativeWindow(void* platformData) { |
23 HINSTANCE hInstance = (HINSTANCE)platformData; | 21 HINSTANCE hInstance = (HINSTANCE)platformData; |
24 | 22 |
25 Window_win* window = new Window_win(); | 23 Window_win* window = new Window_win(); |
26 if (!window->init(hInstance)) { | 24 if (!window->init(hInstance)) { |
27 delete window; | 25 delete window; |
28 return nullptr; | 26 return nullptr; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 bool Window_win::attach(BackendType attachType, const DisplayParams& params) { | 268 bool Window_win::attach(BackendType attachType, const DisplayParams& params) { |
271 ContextPlatformData_win platformData; | 269 ContextPlatformData_win platformData; |
272 platformData.fHInstance = fHInstance; | 270 platformData.fHInstance = fHInstance; |
273 platformData.fHWnd = fHWnd; | 271 platformData.fHWnd = fHWnd; |
274 | 272 |
275 switch (attachType) { | 273 switch (attachType) { |
276 case kNativeGL_BackendType: | 274 case kNativeGL_BackendType: |
277 default: | 275 default: |
278 fWindowContext = GLWindowContext::Create((void*)&platformData, param
s); | 276 fWindowContext = GLWindowContext::Create((void*)&platformData, param
s); |
279 break; | 277 break; |
280 #ifdef SK_VULKAN | 278 |
281 case kVulkan_BackendType: | 279 case kVulkan_BackendType: |
282 fWindowContext = VulkanWindowContext::Create((void*)&platformData, p
arams); | 280 fWindowContext = VulkanWindowContext::Create((void*)&platformData, p
arams); |
283 break; | 281 break; |
284 #endif | |
285 } | 282 } |
286 | 283 |
287 return (SkToBool(fWindowContext)); | 284 return (SkToBool(fWindowContext)); |
288 } | 285 } |
289 | 286 |
290 void Window_win::onInval() { | 287 void Window_win::onInval() { |
291 InvalidateRect(fHWnd, nullptr, false); | 288 InvalidateRect(fHWnd, nullptr, false); |
292 } | 289 } |
293 | 290 |
294 } // namespace sk_app | 291 } // namespace sk_app |
OLD | NEW |