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

Side by Side Diff: src/gpu/gl/angle/SkANGLEGLContext.cpp

Issue 630843002: Make the Sk GL context class an abstract base class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix android link problem and ios compile problem Created 6 years, 2 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/gpu/gl/SkGLContextHelper.cpp ('k') | src/gpu/gl/debug/GrGLCreateDebugInterface.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 2012 Google Inc. 3 * Copyright 2012 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 8
9 #include "gl/SkANGLEGLContext.h" 9 #include "gl/SkANGLEGLContext.h"
10 10
11 SkANGLEGLContext::AutoContextRestore::AutoContextRestore() {
12 fOldEGLContext = eglGetCurrentContext();
13 fOldDisplay = eglGetCurrentDisplay();
14 fOldSurface = eglGetCurrentSurface(EGL_DRAW);
15
16 }
17
18 SkANGLEGLContext::AutoContextRestore::~AutoContextRestore() {
19 if (fOldDisplay) {
20 eglMakeCurrent(fOldDisplay, fOldSurface, fOldSurface, fOldEGLContext);
21 }
22 }
23
24 ///////////////////////////////////////////////////////////////////////////////
25
26 SkANGLEGLContext::SkANGLEGLContext() 11 SkANGLEGLContext::SkANGLEGLContext()
27 : fContext(EGL_NO_CONTEXT) 12 : fContext(EGL_NO_CONTEXT)
28 , fDisplay(EGL_NO_DISPLAY) 13 , fDisplay(EGL_NO_DISPLAY)
29 , fSurface(EGL_NO_SURFACE) { 14 , fSurface(EGL_NO_SURFACE) {
30 } 15 }
31 16
32 SkANGLEGLContext::~SkANGLEGLContext() { 17 SkANGLEGLContext::~SkANGLEGLContext() {
33 this->destroyGLContext(); 18 this->destroyGLContext();
34 } 19 }
35 20
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 if (!eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) { 92 if (!eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) {
108 SkDebugf("Could not set the context.\n"); 93 SkDebugf("Could not set the context.\n");
109 } 94 }
110 } 95 }
111 96
112 void SkANGLEGLContext::swapBuffers() const { 97 void SkANGLEGLContext::swapBuffers() const {
113 if (!eglSwapBuffers(fDisplay, fSurface)) { 98 if (!eglSwapBuffers(fDisplay, fSurface)) {
114 SkDebugf("Could not complete eglSwapBuffers.\n"); 99 SkDebugf("Could not complete eglSwapBuffers.\n");
115 } 100 }
116 } 101 }
OLDNEW
« no previous file with comments | « src/gpu/gl/SkGLContextHelper.cpp ('k') | src/gpu/gl/debug/GrGLCreateDebugInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698