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

Side by Side Diff: src/views/unix/SkOSWindow_Unix.cpp

Issue 1809733002: detach -> release (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: (C) Created 4 years, 9 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 | « src/views/sdl/SkOSWindow_SDL.cpp ('k') | src/views/win/SkOSWindow_win.cpp » ('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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 #include <X11/XKBlib.h> 10 #include <X11/XKBlib.h>
(...skipping 29 matching lines...) Expand all
40 this->initWindow(0, nullptr); 40 this->initWindow(0, nullptr);
41 this->resize(WIDTH, HEIGHT); 41 this->resize(WIDTH, HEIGHT);
42 } 42 }
43 43
44 SkOSWindow::~SkOSWindow() { 44 SkOSWindow::~SkOSWindow() {
45 this->internalCloseWindow(); 45 this->internalCloseWindow();
46 } 46 }
47 47
48 void SkOSWindow::internalCloseWindow() { 48 void SkOSWindow::internalCloseWindow() {
49 if (fUnixWindow.fDisplay) { 49 if (fUnixWindow.fDisplay) {
50 this->detach(); 50 this->release();
51 SkASSERT(fUnixWindow.fGc); 51 SkASSERT(fUnixWindow.fGc);
52 XFreeGC(fUnixWindow.fDisplay, fUnixWindow.fGc); 52 XFreeGC(fUnixWindow.fDisplay, fUnixWindow.fGc);
53 fUnixWindow.fGc = nullptr; 53 fUnixWindow.fGc = nullptr;
54 XDestroyWindow(fUnixWindow.fDisplay, fUnixWindow.fWin); 54 XDestroyWindow(fUnixWindow.fDisplay, fUnixWindow.fWin);
55 fVi = nullptr; 55 fVi = nullptr;
56 XCloseDisplay(fUnixWindow.fDisplay); 56 XCloseDisplay(fUnixWindow.fDisplay);
57 fUnixWindow.fDisplay = nullptr; 57 fUnixWindow.fDisplay = nullptr;
58 fMSAASampleCount = 0; 58 fMSAASampleCount = 0;
59 } 59 }
60 } 60 }
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 fUnixWindow.fGLContext); 371 fUnixWindow.fGLContext);
372 glViewport(0, 0, 372 glViewport(0, 0,
373 SkScalarRoundToInt(this->width()), 373 SkScalarRoundToInt(this->width()),
374 SkScalarRoundToInt(this->height())); 374 SkScalarRoundToInt(this->height()));
375 glClearColor(0, 0, 0, 0); 375 glClearColor(0, 0, 0, 0);
376 glClearStencil(0); 376 glClearStencil(0);
377 glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 377 glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
378 return true; 378 return true;
379 } 379 }
380 380
381 void SkOSWindow::detach() { 381 void SkOSWindow::release() {
382 if (nullptr == fUnixWindow.fDisplay || nullptr == fUnixWindow.fGLContext) { 382 if (nullptr == fUnixWindow.fDisplay || nullptr == fUnixWindow.fGLContext) {
383 return; 383 return;
384 } 384 }
385 glXMakeCurrent(fUnixWindow.fDisplay, None, nullptr); 385 glXMakeCurrent(fUnixWindow.fDisplay, None, nullptr);
386 glXDestroyContext(fUnixWindow.fDisplay, fUnixWindow.fGLContext); 386 glXDestroyContext(fUnixWindow.fDisplay, fUnixWindow.fGLContext);
387 fUnixWindow.fGLContext = nullptr; 387 fUnixWindow.fGLContext = nullptr;
388 } 388 }
389 389
390 void SkOSWindow::present() { 390 void SkOSWindow::present() {
391 if (fUnixWindow.fDisplay && fUnixWindow.fGLContext) { 391 if (fUnixWindow.fDisplay && fUnixWindow.fGLContext) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 510
511 void SkEvent::SignalNonEmptyQueue() { 511 void SkEvent::SignalNonEmptyQueue() {
512 // nothing to do, since we spin on our event-queue, polling for XPending 512 // nothing to do, since we spin on our event-queue, polling for XPending
513 } 513 }
514 514
515 void SkEvent::SignalQueueTimer(SkMSec delay) { 515 void SkEvent::SignalQueueTimer(SkMSec delay) {
516 // just need to record the delay time. We handle waking up for it in 516 // just need to record the delay time. We handle waking up for it in
517 // MyXNextEventWithDelay() 517 // MyXNextEventWithDelay()
518 gTimerDelay = delay; 518 gTimerDelay = delay;
519 } 519 }
OLDNEW
« no previous file with comments | « src/views/sdl/SkOSWindow_SDL.cpp ('k') | src/views/win/SkOSWindow_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698