Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Unified Diff: ui/gl/gl_surface_osmesa.cc

Issue 15928002: GPU: Keep track of the last real context and real surface made current. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nix unnecessary changes. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gl_surface_egl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_surface_osmesa.cc
diff --git a/ui/gl/gl_surface_osmesa.cc b/ui/gl/gl_surface_osmesa.cc
index 7994eec379187df5b0838ab1f7749615d8fff3ae..9a556bc9982d528dcfb40aa81fc08e861e454b27 100644
--- a/ui/gl/gl_surface_osmesa.cc
+++ b/ui/gl/gl_surface_osmesa.cc
@@ -6,6 +6,7 @@
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_surface_osmesa.h"
+#include "ui/gl/scoped_make_current.h"
namespace gfx {
@@ -23,10 +24,15 @@ void GLSurfaceOSMesa::Destroy() {
}
bool GLSurfaceOSMesa::Resize(const gfx::Size& new_size) {
+ scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current;
GLContext* current_context = GLContext::GetCurrent();
- bool was_current = current_context && current_context->IsCurrent(this);
- if (was_current)
+ bool was_current =
+ current_context && current_context->IsCurrent(this);
+ if (was_current) {
+ scoped_make_current.reset(
+ new ui::ScopedMakeCurrent(current_context, this));
current_context->ReleaseCurrent(this);
+ }
// Preserve the old buffer.
scoped_ptr<int32[]> old_buffer(buffer_.release());
@@ -48,9 +54,6 @@ bool GLSurfaceOSMesa::Resize(const gfx::Size& new_size) {
size_ = new_size;
- if (was_current)
- return current_context->MakeCurrent(this);
-
return true;
}
« no previous file with comments | « ui/gl/gl_surface_egl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698