summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 17:57:57 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 17:57:57 +0000
commit40606261a30c109e69053be82e98769652c48e5c (patch)
tree5ed7618eaae5cac43f1cd44170ff46ac29c9676a /app
parent265ccd99339c4a7bcdc3c163692f9344fe9e2ae5 (diff)
downloadchromium_src-40606261a30c109e69053be82e98769652c48e5c.zip
chromium_src-40606261a30c109e69053be82e98769652c48e5c.tar.gz
chromium_src-40606261a30c109e69053be82e98769652c48e5c.tar.bz2
OSMesa was not being correctly initialized when used with WebGL.
GLEW was not being initialized and the back buffer was not being cleared. Back buffer was not being deallocated in OSMesaGLContext::Destroy. TEST=trybots BUG=none Review URL: http://codereview.chromium.org/1792008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45958 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/gfx/gl/gl_context_osmesa.cc36
-rw-r--r--app/gfx/gl/gl_context_osmesa.h3
-rw-r--r--app/gfx/gl/gl_context_win.cc15
3 files changed, 21 insertions, 33 deletions
diff --git a/app/gfx/gl/gl_context_osmesa.cc b/app/gfx/gl/gl_context_osmesa.cc
index 86f795e..49057d2 100644
--- a/app/gfx/gl/gl_context_osmesa.cc
+++ b/app/gfx/gl/gl_context_osmesa.cc
@@ -11,10 +11,7 @@
namespace gfx {
-OSMesaGLContext::OSMesaGLContext()
-#if !defined(UNIT_TEST)
- : context_(NULL)
-#endif
+OSMesaGLContext::OSMesaGLContext() : context_(NULL)
{
}
@@ -22,7 +19,6 @@ OSMesaGLContext::~OSMesaGLContext() {
}
bool OSMesaGLContext::Initialize(void* shared_handle) {
-#if !defined(UNIT_TEST)
DCHECK(!context_);
size_ = gfx::Size(1, 1);
@@ -30,38 +26,48 @@ bool OSMesaGLContext::Initialize(void* shared_handle) {
context_ = OSMesaCreateContext(GL_RGBA,
static_cast<OSMesaContext>(shared_handle));
- return context_ != NULL;
-#else
+ if (!context_)
+ return false;
+
+ if (!MakeCurrent()) {
+ Destroy();
+ return false;
+ }
+
+ if (!InitializeGLEW()) {
+ Destroy();
+ return false;
+ }
+
+ if (!InitializeCommon()) {
+ Destroy();
+ return false;
+ }
+
return true;
-#endif
}
void OSMesaGLContext::Destroy() {
-#if !defined(UNIT_TEST)
if (context_) {
OSMesaDestroyContext(static_cast<OSMesaContext>(context_));
context_ = NULL;
}
-#endif
+ buffer_.reset();
+ size_ = gfx::Size();
}
bool OSMesaGLContext::MakeCurrent() {
-#if !defined(UNIT_TEST)
DCHECK(context_);
return OSMesaMakeCurrent(static_cast<OSMesaContext>(context_),
buffer_.get(),
GL_UNSIGNED_BYTE,
size_.width(), size_.height()) == GL_TRUE;
-#endif
return true;
}
bool OSMesaGLContext::IsCurrent() {
-#if !defined(UNIT_TEST)
DCHECK(context_);
return context_ == OSMesaGetCurrentContext();
-#endif
- return true;
}
bool OSMesaGLContext::IsOffscreen() {
diff --git a/app/gfx/gl/gl_context_osmesa.h b/app/gfx/gl/gl_context_osmesa.h
index 52738de..4959c846 100644
--- a/app/gfx/gl/gl_context_osmesa.h
+++ b/app/gfx/gl/gl_context_osmesa.h
@@ -39,9 +39,6 @@ class OSMesaGLContext : public GLContext {
return buffer_.get();
}
- protected:
- bool InitializeCommon();
-
private:
#if !defined(UNIT_TEST)
gfx::Size size_;
diff --git a/app/gfx/gl/gl_context_win.cc b/app/gfx/gl/gl_context_win.cc
index 0f4d570..9a5008f 100644
--- a/app/gfx/gl/gl_context_win.cc
+++ b/app/gfx/gl/gl_context_win.cc
@@ -380,21 +380,6 @@ bool OSMesaViewGLContext::Initialize() {
return false;
}
- if (!MakeCurrent()) {
- Destroy();
- return false;
- }
-
- if (!InitializeGLEW()) {
- Destroy();
- return false;
- }
-
- if (!InitializeCommon()) {
- Destroy();
- return false;
- }
-
UpdateSize();
return true;