diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-03 18:11:52 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-03 18:11:52 +0000 |
commit | f1555d8337c24a9b88d80c0ddde8d8865f737dc4 (patch) | |
tree | fe198192bba86033250ac397e55a24cd8f8bd57f /ui/gfx | |
parent | 4297cbeb84a2355ca73e6da0d6e3548c6d9792d4 (diff) | |
download | chromium_src-f1555d8337c24a9b88d80c0ddde8d8865f737dc4.zip chromium_src-f1555d8337c24a9b88d80c0ddde8d8865f737dc4.tar.gz chromium_src-f1555d8337c24a9b88d80c0ddde8d8865f737dc4.tar.bz2 |
Fix gl context change on dropping a texture
As we are now recomputing holes in the draw path, we cannot change the GLContext. This patch resets the change in GL context incurred by DropTexture.
BUG=
TEST=
Review URL: http://codereview.chromium.org/8418035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108501 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx')
-rw-r--r-- | ui/gfx/compositor/compositor_gl.cc | 6 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor_gl.h | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/ui/gfx/compositor/compositor_gl.cc b/ui/gfx/compositor/compositor_gl.cc index 3d53d28..078556b 100644 --- a/ui/gfx/compositor/compositor_gl.cc +++ b/ui/gfx/compositor/compositor_gl.cc @@ -349,6 +349,10 @@ bool SharedResourcesGL::MakeSharedContextCurrent() { return context_->MakeCurrent(surface_.get()); } +gfx::ScopedMakeCurrent* SharedResourcesGL::GetScopedMakeCurrent() { + return new gfx::ScopedMakeCurrent(context_.get(), surface_.get()); +} + scoped_refptr<gfx::GLContext> SharedResourcesGL::CreateContext( gfx::GLSurface* surface) { if (initialized_) @@ -374,7 +378,7 @@ TextureGL::~TextureGL() { if (texture_id_) { SharedResourcesGL* instance = SharedResourcesGL::GetInstance(); DCHECK(instance); - instance->MakeSharedContextCurrent(); + scoped_ptr<gfx::ScopedMakeCurrent> bind(instance->GetScopedMakeCurrent()); glDeleteTextures(1, &texture_id_); } } diff --git a/ui/gfx/compositor/compositor_gl.h b/ui/gfx/compositor/compositor_gl.h index 586e793..871f7aa 100644 --- a/ui/gfx/compositor/compositor_gl.h +++ b/ui/gfx/compositor/compositor_gl.h @@ -11,6 +11,7 @@ #include "base/memory/singleton.h" #include "base/memory/ref_counted.h" #include "ui/gfx/compositor/compositor.h" +#include "ui/gfx/gl/scoped_make_current.h" #include "ui/gfx/size.h" namespace gfx { @@ -32,6 +33,10 @@ class COMPOSITOR_EXPORT SharedResourcesGL : public SharedResources { virtual bool MakeSharedContextCurrent(); + // Creates an instance of ScopedMakeCurrent. + // Note: Caller is responsible for managing lifetime of returned pointer. + gfx::ScopedMakeCurrent* GetScopedMakeCurrent(); + // Creates a context that shares the resources hosted by this singleton. scoped_refptr<gfx::GLContext> CreateContext(gfx::GLSurface* surface); |