| OLD | NEW |
| 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() { | 11 SkANGLEGLContext::AutoContextRestore::AutoContextRestore() { |
| 12 fOldEGLContext = eglGetCurrentContext(); | 12 fOldEGLContext = eglGetCurrentContext(); |
| 13 fOldDisplay = eglGetCurrentDisplay(); | 13 fOldDisplay = eglGetCurrentDisplay(); |
| 14 fOldSurface = eglGetCurrentSurface(EGL_DRAW); | 14 fOldSurface = eglGetCurrentSurface(EGL_DRAW); |
| 15 | 15 |
| 16 } | 16 } |
| 17 | 17 |
| 18 SkANGLEGLContext::AutoContextRestore::~AutoContextRestore() { | 18 SkANGLEGLContext::AutoContextRestore::~AutoContextRestore() { |
| 19 if (NULL != fOldDisplay) { | 19 if (fOldDisplay) { |
| 20 eglMakeCurrent(fOldDisplay, fOldSurface, fOldSurface, fOldEGLContext); | 20 eglMakeCurrent(fOldDisplay, fOldSurface, fOldSurface, fOldEGLContext); |
| 21 } | 21 } |
| 22 } | 22 } |
| 23 | 23 |
| 24 /////////////////////////////////////////////////////////////////////////////// | 24 /////////////////////////////////////////////////////////////////////////////// |
| 25 | 25 |
| 26 SkANGLEGLContext::SkANGLEGLContext() | 26 SkANGLEGLContext::SkANGLEGLContext() |
| 27 : fContext(EGL_NO_CONTEXT) | 27 : fContext(EGL_NO_CONTEXT) |
| 28 , fDisplay(EGL_NO_DISPLAY) | 28 , fDisplay(EGL_NO_DISPLAY) |
| 29 , fSurface(EGL_NO_SURFACE) { | 29 , fSurface(EGL_NO_SURFACE) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 if (!eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) { | 107 if (!eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) { |
| 108 SkDebugf("Could not set the context.\n"); | 108 SkDebugf("Could not set the context.\n"); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 void SkANGLEGLContext::swapBuffers() const { | 112 void SkANGLEGLContext::swapBuffers() const { |
| 113 if (!eglSwapBuffers(fDisplay, fSurface)) { | 113 if (!eglSwapBuffers(fDisplay, fSurface)) { |
| 114 SkDebugf("Could not complete eglSwapBuffers.\n"); | 114 SkDebugf("Could not complete eglSwapBuffers.\n"); |
| 115 } | 115 } |
| 116 } | 116 } |
| OLD | NEW |