Commit f189b252 authored by apatrick@chromium.org's avatar apatrick@chromium.org

GLSurface::Resize implementations release the current context if they are current before resize.

This is because, if the newly allocated surface happens to have the same handle / address, a subsequent MakeCurrent will think that the surface has not changed and early out.
Review URL: http://codereview.chromium.org/8869007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113677 0039d316-1c4b-4281-b951-d872f2087c98
parent 207ff667
......@@ -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() {
......
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment