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)) |