| 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 "VulkanWindowContext_win.h" | 15 #include "../GLWindowContext.h" |
| 16 #include "../VulkanWindowContext.h" |
| 16 | 17 |
| 17 namespace sk_app { | 18 namespace sk_app { |
| 18 | 19 |
| 19 Window* Window::CreateNativeWindow(void* platformData) { | 20 Window* Window::CreateNativeWindow(void* platformData) { |
| 20 HINSTANCE hInstance = (HINSTANCE)platformData; | 21 HINSTANCE hInstance = (HINSTANCE)platformData; |
| 21 | 22 |
| 22 Window_win* window = new Window_win(); | 23 Window_win* window = new Window_win(); |
| 23 if (!window->init(hInstance)) { | 24 if (!window->init(hInstance)) { |
| 24 delete window; | 25 delete window; |
| 25 return nullptr; | 26 return nullptr; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 258 |
| 258 void Window_win::setTitle(const char* title) { | 259 void Window_win::setTitle(const char* title) { |
| 259 SetWindowTextA(fHWnd, title); | 260 SetWindowTextA(fHWnd, title); |
| 260 } | 261 } |
| 261 | 262 |
| 262 void Window_win::show() { | 263 void Window_win::show() { |
| 263 ShowWindow(fHWnd, SW_SHOW); | 264 ShowWindow(fHWnd, SW_SHOW); |
| 264 } | 265 } |
| 265 | 266 |
| 266 | 267 |
| 267 bool Window_win::attach(BackEndType attachType, const DisplayParams& params) { | 268 bool Window_win::attach(BackendType attachType, const DisplayParams& params) { |
| 268 if (kVulkan_BackendType != attachType) { | |
| 269 return false; | |
| 270 } | |
| 271 | |
| 272 ContextPlatformData_win platformData; | 269 ContextPlatformData_win platformData; |
| 273 platformData.fHInstance = fHInstance; | 270 platformData.fHInstance = fHInstance; |
| 274 platformData.fHWnd = fHWnd; | 271 platformData.fHWnd = fHWnd; |
| 275 | 272 |
| 276 fWindowContext = VulkanWindowContext::Create((void*)&platformData, params); | 273 switch (attachType) { |
| 274 case kNativeGL_BackendType: |
| 275 default: |
| 276 fWindowContext = GLWindowContext::Create((void*)&platformData, param
s); |
| 277 break; |
| 278 |
| 279 case kVulkan_BackendType: |
| 280 fWindowContext = VulkanWindowContext::Create((void*)&platformData, p
arams); |
| 281 break; |
| 282 } |
| 277 | 283 |
| 278 return (SkToBool(fWindowContext)); | 284 return (SkToBool(fWindowContext)); |
| 279 } | 285 } |
| 280 | 286 |
| 281 void Window_win::inval() { | 287 void Window_win::inval() { |
| 282 InvalidateRect(fHWnd, nullptr, false); | 288 InvalidateRect(fHWnd, nullptr, false); |
| 283 } | 289 } |
| 284 | 290 |
| 285 } // namespace sk_app | 291 } // namespace sk_app |
| OLD | NEW |