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

Side by Side Diff: tools/viewer/sk_app/unix/Window_unix.cpp

Issue 2165813002: Add sw support to viewer on Linux. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: rebase 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/unix/WindowContextFactory_unix.h ('k') | no next file » | 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 "WindowContextFactory_unix.h" 10 #include "WindowContextFactory_unix.h"
(...skipping 29 matching lines...) Expand all
40 KeyPressMask | KeyReleaseMask | 40 KeyPressMask | KeyReleaseMask |
41 PointerMotionMask | ButtonPressMask | ButtonReleaseMask; 41 PointerMotionMask | ButtonPressMask | ButtonReleaseMask;
42 42
43 bool Window_unix::initWindow(Display* display, const DisplayParams* params) { 43 bool Window_unix::initWindow(Display* display, const DisplayParams* params) {
44 if (params && params->fMSAASampleCount != fMSAASampleCount) { 44 if (params && params->fMSAASampleCount != fMSAASampleCount) {
45 this->closeWindow(); 45 this->closeWindow();
46 } 46 }
47 // we already have a window 47 // we already have a window
48 if (fDisplay) { 48 if (fDisplay) {
49 return true; 49 return true;
50 } 50 }
51 fDisplay = display; 51 fDisplay = display;
52 52
53 fWidth = 1280; 53 fWidth = 1280;
54 fHeight = 960; 54 fHeight = 960;
55 55
56 // Attempt to create a window that supports GL 56 // Attempt to create a window that supports GL
57 GLint att[] = { 57 GLint att[] = {
58 GLX_RGBA, 58 GLX_RGBA,
59 GLX_DEPTH_SIZE, 24, 59 GLX_DEPTH_SIZE, 24,
60 GLX_DOUBLEBUFFER, 60 GLX_DOUBLEBUFFER,
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 XSetWMName(fDisplay, fWindow, &textproperty); 265 XSetWMName(fDisplay, fWindow, &textproperty);
266 } 266 }
267 267
268 void Window_unix::show() { 268 void Window_unix::show() {
269 XMapWindow(fDisplay, fWindow); 269 XMapWindow(fDisplay, fWindow);
270 } 270 }
271 271
272 bool Window_unix::attach(BackendType attachType, const DisplayParams& params) { 272 bool Window_unix::attach(BackendType attachType, const DisplayParams& params) {
273 this->initWindow(fDisplay, &params); 273 this->initWindow(fDisplay, &params);
274 274
275 window_context_factory::XlibWindowInfo xwinInfo; 275 window_context_factory::XlibWindowInfo winInfo;
276 xwinInfo.fDisplay = fDisplay; 276 winInfo.fDisplay = fDisplay;
277 xwinInfo.fWindow = fWindow; 277 winInfo.fWindow = fWindow;
278 xwinInfo.fVisualInfo = fVisualInfo; 278 winInfo.fVisualInfo = fVisualInfo;
279 switch (attachType) { 279 switch (attachType) {
280 #ifdef SK_VULKAN 280 #ifdef SK_VULKAN
281 case kVulkan_BackendType: 281 case kVulkan_BackendType:
282 fWindowContext = window_context_factory::NewVulkanForXlib(xwinInfo, params); 282 fWindowContext = window_context_factory::NewVulkanForXlib(winInfo, p arams);
283 break; 283 break;
284 #endif 284 #endif
285 case kNativeGL_BackendType: 285 case kNativeGL_BackendType:
286 default: 286 fWindowContext = window_context_factory::NewGLForXlib(winInfo, param s);
287 fWindowContext = window_context_factory::NewGLForXlib(xwinInfo, para ms); 287 break;
288 case kRaster_BackendType:
289 fWindowContext = window_context_factory::NewRasterForXlib(winInfo, p arams);
288 break; 290 break;
289 } 291 }
290 292
291 return (SkToBool(fWindowContext)); 293 return (SkToBool(fWindowContext));
292 } 294 }
293 295
294 void Window_unix::onInval() { 296 void Window_unix::onInval() {
295 XEvent event; 297 XEvent event;
296 event.type = Expose; 298 event.type = Expose;
297 event.xexpose.send_event = True; 299 event.xexpose.send_event = True;
298 event.xexpose.display = fDisplay; 300 event.xexpose.display = fDisplay;
299 event.xexpose.window = fWindow; 301 event.xexpose.window = fWindow;
300 event.xexpose.x = 0; 302 event.xexpose.x = 0;
301 event.xexpose.y = 0; 303 event.xexpose.y = 0;
302 event.xexpose.width = fWidth; 304 event.xexpose.width = fWidth;
303 event.xexpose.height = fHeight; 305 event.xexpose.height = fHeight;
304 event.xexpose.count = 0; 306 event.xexpose.count = 0;
305 307
306 XSendEvent(fDisplay, fWindow, False, 0, &event); 308 XSendEvent(fDisplay, fWindow, False, 0, &event);
307 } 309 }
308 310
309 } // namespace sk_app 311 } // namespace sk_app
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/unix/WindowContextFactory_unix.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698