| 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 <tchar.h> | 8 //#include <tchar.h> |
| 9 | 9 |
| 10 #include "SkUtils.h" | 10 #include "SkUtils.h" |
| 11 #include "Timer.h" | 11 #include "Timer.h" |
| 12 #include "../GLWindowContext.h" | 12 #include "WindowContextFactory_mac.h" |
| 13 #include "Window_mac.h" | 13 #include "Window_mac.h" |
| 14 | 14 |
| 15 namespace sk_app { | 15 namespace sk_app { |
| 16 | 16 |
| 17 Window* Window::CreateNativeWindow(void* platformData) { | 17 Window* Window::CreateNativeWindow(void* platformData) { |
| 18 #if 0 | 18 #if 0 |
| 19 // TODO: platform-specific window creation | 19 // TODO: platform-specific window creation |
| 20 Display* display = (Display*)platformData; | 20 Display* display = (Display*)platformData; |
| 21 | 21 |
| 22 Window_mac* window = new Window_mac(); | 22 Window_mac* window = new Window_mac(); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 XSetWMName(fDisplay, fWindow, &textproperty); | 263 XSetWMName(fDisplay, fWindow, &textproperty); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void Window_mac::show() { | 266 void Window_mac::show() { |
| 267 XMapWindow(fDisplay, fWindow); | 267 XMapWindow(fDisplay, fWindow); |
| 268 } | 268 } |
| 269 | 269 |
| 270 bool Window_mac::attach(BackendType attachType, const DisplayParams& params) { | 270 bool Window_mac::attach(BackendType attachType, const DisplayParams& params) { |
| 271 this->initWindow(fDisplay, ¶ms); | 271 this->initWindow(fDisplay, ¶ms); |
| 272 | 272 |
| 273 ContextPlatformData_mac platformData; | 273 MacWindowInfo info; |
| 274 platformData.fDisplay = fDisplay; | 274 #if 0 |
| 275 platformData.fWindow = fWindow; | 275 // Init Mac window info here |
| 276 platformData.fVisualInfo = fVisualInfo; | 276 info.foo = foo; |
| 277 #endif |
| 277 switch (attachType) { | 278 switch (attachType) { |
| 278 #ifdef SK_VULKAN | 279 #ifdef SK_VULKAN |
| 279 case kVulkan_BackendType: | 280 case kVulkan_BackendType: |
| 280 fWindowContext = VulkanWindowContext::Create((void*)&platformData, p
arams); | 281 fWindowContext = NewVulkanForMac(info, params); |
| 281 break; | 282 break; |
| 282 #endif | 283 #endif |
| 283 case kNativeGL_BackendType: | 284 case kNativeGL_BackendType: |
| 284 default: | 285 default: |
| 285 fWindowContext = GLWindowContext::Create((void*)&platformData, param
s); | 286 fWindowContext = NewGLForMac(info, params); |
| 286 break; | 287 break; |
| 287 } | 288 } |
| 288 | 289 |
| 289 return (SkToBool(fWindowContext)); | 290 return (SkToBool(fWindowContext)); |
| 290 } | 291 } |
| 291 | 292 |
| 292 void Window_mac::onInval() { | 293 void Window_mac::onInval() { |
| 293 XEvent event; | 294 XEvent event; |
| 294 event.type = Expose; | 295 event.type = Expose; |
| 295 event.xexpose.send_event = True; | 296 event.xexpose.send_event = True; |
| 296 event.xexpose.display = fDisplay; | 297 event.xexpose.display = fDisplay; |
| 297 event.xexpose.window = fWindow; | 298 event.xexpose.window = fWindow; |
| 298 event.xexpose.x = 0; | 299 event.xexpose.x = 0; |
| 299 event.xexpose.y = 0; | 300 event.xexpose.y = 0; |
| 300 event.xexpose.width = fWidth; | 301 event.xexpose.width = fWidth; |
| 301 event.xexpose.height = fHeight; | 302 event.xexpose.height = fHeight; |
| 302 event.xexpose.count = 0; | 303 event.xexpose.count = 0; |
| 303 | 304 |
| 304 XSendEvent(fDisplay, fWindow, False, 0, &event); | 305 XSendEvent(fDisplay, fWindow, False, 0, &event); |
| 305 } | 306 } |
| 306 #endif | 307 #endif |
| 307 | 308 |
| 308 } // namespace sk_app | 309 } // namespace sk_app |
| OLD | NEW |