summaryrefslogtreecommitdiffstats
path: root/ui/gl
diff options
context:
space:
mode:
authorjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-19 23:58:36 +0000
committerjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-19 23:58:36 +0000
commit3196e42a57b359527039fff8873c5f6674d0d9a9 (patch)
treec1001d0ab310aebbf680727d5c2a49bad59a7d06 /ui/gl
parentd3b3864c558689a119dd54df48b44cf8e10ea0c2 (diff)
downloadchromium_src-3196e42a57b359527039fff8873c5f6674d0d9a9.zip
chromium_src-3196e42a57b359527039fff8873c5f6674d0d9a9.tar.gz
chromium_src-3196e42a57b359527039fff8873c5f6674d0d9a9.tar.bz2
Recreate egl surface on resize.
The surface was being resized too late, after it had been drawn to at the new size, causing there to be garbage. If we recreate it then it will be the correct size. BUG=145295 Review URL: https://chromiumcodereview.appspot.com/10939038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157661 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gl')
-rw-r--r--ui/gl/gl_surface_egl.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc
index 0dfa4de..2fe3710 100644
--- a/ui/gl/gl_surface_egl.cc
+++ b/ui/gl/gl_surface_egl.cc
@@ -339,7 +339,24 @@ gfx::Size NativeViewGLSurfaceEGL::GetSize() {
}
bool NativeViewGLSurfaceEGL::Resize(const gfx::Size& size) {
- return size == GetSize();
+ if (size == GetSize())
+ return true;
+
+ GLContext* current_context = GLContext::GetCurrent();
+ bool was_current = current_context && current_context->IsCurrent(this);
+ if (was_current)
+ current_context->ReleaseCurrent(this);
+
+ Destroy();
+
+ if (!Initialize()) {
+ LOG(ERROR) << "Failed to resize pbuffer.";
+ return false;
+ }
+
+ if (was_current)
+ return current_context->MakeCurrent(this);
+ return true;
}
EGLSurface NativeViewGLSurfaceEGL::GetHandle() {