diff options
Diffstat (limited to 'ui/gfx/gl')
-rw-r--r-- | ui/gfx/gl/gl_surface_egl.cc | 16 | ||||
-rw-r--r-- | ui/gfx/gl/gl_surface_osmesa.cc | 10 |
2 files changed, 25 insertions, 1 deletions
diff --git a/ui/gfx/gl/gl_surface_egl.cc b/ui/gfx/gl/gl_surface_egl.cc index f1d0750..1e32cc0 100644 --- a/ui/gfx/gl/gl_surface_egl.cc +++ b/ui/gfx/gl/gl_surface_egl.cc @@ -12,6 +12,7 @@ #include "third_party/angle/include/EGL/eglext.h" #endif #include "ui/gfx/gl/egl_util.h" +#include "ui/gfx/gl/gl_context.h" #if defined(OS_ANDROID) #include <EGL/egl.h> @@ -357,9 +358,22 @@ bool PbufferGLSurfaceEGL::Resize(const gfx::Size& size) { if (size == size_) return true; + GLContext* current_context = GLContext::GetCurrent(); + bool was_current = current_context && current_context->IsCurrent(this); + if (was_current) + current_context->ReleaseCurrent(this); + Destroy(); + size_ = size; - return Initialize(); + + if (!Initialize()) + return false; + + if (was_current) + return current_context->MakeCurrent(this); + + return true; } EGLSurface PbufferGLSurfaceEGL::GetHandle() { diff --git a/ui/gfx/gl/gl_surface_osmesa.cc b/ui/gfx/gl/gl_surface_osmesa.cc index 2fe5e38..a6d4b4c 100644 --- a/ui/gfx/gl/gl_surface_osmesa.cc +++ b/ui/gfx/gl/gl_surface_osmesa.cc @@ -5,6 +5,7 @@ #include "ui/gfx/gl/gl_surface_osmesa.h" #include "base/logging.h" #include "ui/gfx/gl/gl_bindings.h" +#include "ui/gfx/gl/gl_context.h" namespace gfx { @@ -21,6 +22,11 @@ bool GLSurfaceOSMesa::Resize(const gfx::Size& new_size) { if (new_size == size_) return true; + GLContext* current_context = GLContext::GetCurrent(); + bool was_current = current_context && current_context->IsCurrent(this); + if (was_current) + current_context->ReleaseCurrent(this); + // Preserve the old buffer. scoped_array<int32> old_buffer(buffer_.release()); @@ -37,6 +43,10 @@ bool GLSurfaceOSMesa::Resize(const gfx::Size& new_size) { } size_ = new_size; + + if (was_current) + return current_context->MakeCurrent(this); + return true; } |