Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: tools/viewer/sk_app/mac/Window_mac.cpp

Issue 2169543002: Use Windowing system-specific WindowContext factories. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: more xlib Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/viewer/sk_app/mac/Window_mac.h ('k') | tools/viewer/sk_app/unix/GLWindowContext_unix.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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, &params); 271 this->initWindow(fDisplay, &params);
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
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/mac/Window_mac.h ('k') | tools/viewer/sk_app/unix/GLWindowContext_unix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698