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

Unified Diff: src/gpu/gl/mesa/SkMesaGLContext.cpp

Issue 639793002: Revert of Make the Sk GL context class an abstract base class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/mac/SkNativeGLContext_mac.cpp ('k') | src/gpu/gl/nacl/SkCreatePlatformGLContext_nacl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/mesa/SkMesaGLContext.cpp
diff --git a/src/gpu/gl/mesa/SkMesaGLContext.cpp b/src/gpu/gl/mesa/SkMesaGLContext.cpp
index 8c339c7fac4fc50ac837b4155464b92d6a8e7b69..31402c5a3cf79cd3ebcd392ba5a85c1114583867 100644
--- a/src/gpu/gl/mesa/SkMesaGLContext.cpp
+++ b/src/gpu/gl/mesa/SkMesaGLContext.cpp
@@ -10,6 +10,24 @@
#include "gl/SkMesaGLContext.h"
#include "gl/GrGLDefines.h"
+
+SkMesaGLContext::AutoContextRestore::AutoContextRestore() {
+ fOldContext = (Context)OSMesaGetCurrentContext();
+ if (fOldContext) {
+ OSMesaGetColorBuffer((OSMesaContext)fOldContext,
+ &fOldWidth, &fOldHeight,
+ &fOldFormat, &fOldImage);
+ }
+}
+
+SkMesaGLContext::AutoContextRestore::~AutoContextRestore() {
+ if (fOldContext) {
+ OSMesaMakeCurrent((OSMesaContext)fOldContext, fOldImage,
+ fOldFormat, fOldWidth, fOldHeight);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
SkMesaGLContext::SkMesaGLContext()
: fContext(static_cast<Context>(NULL))
« no previous file with comments | « src/gpu/gl/mac/SkNativeGLContext_mac.cpp ('k') | src/gpu/gl/nacl/SkCreatePlatformGLContext_nacl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698