summaryrefslogtreecommitdiffstats
path: root/ui/gfx
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-27 23:13:52 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-27 23:13:52 +0000
commita41277237abfc70cb7d10758e69083fb00d74c67 (patch)
treed0c621ea5388430817520342d64754dbe23e6bcc /ui/gfx
parenteca2e17113086ec1b0dbfdd2dfa053166baf8b1a (diff)
downloadchromium_src-a41277237abfc70cb7d10758e69083fb00d74c67.zip
chromium_src-a41277237abfc70cb7d10758e69083fb00d74c67.tar.gz
chromium_src-a41277237abfc70cb7d10758e69083fb00d74c67.tar.bz2
Removed "compositor" child window that was created by the GPU process.Removed the sync IPC that it used to ask the browser process to resize on Linux. Adapted windows to use the same mechanism.TEST=test webgl pages on windows (ANGLE and GL), linux and mac, run try job on windows, linux, mac. checkdeps failure look unrelated to patch.BUG=77536
Review URL: http://codereview.chromium.org/6880218 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83248 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx')
-rw-r--r--ui/gfx/gl/gl_context.cc9
-rw-r--r--ui/gfx/gl/gl_context.h10
-rw-r--r--ui/gfx/gl/gl_context_egl.cc18
-rw-r--r--ui/gfx/gl/gl_context_egl.h4
-rw-r--r--ui/gfx/gl/gl_surface.h6
5 files changed, 45 insertions, 2 deletions
diff --git a/ui/gfx/gl/gl_context.cc b/ui/gfx/gl/gl_context.cc
index 847c9bb..630925d 100644
--- a/ui/gfx/gl/gl_context.cc
+++ b/ui/gfx/gl/gl_context.cc
@@ -13,6 +13,15 @@
namespace gfx {
+void GLContext::ReleaseCurrent() {
+ // TODO(apatrick): Implement this in GLContext derivatives.
+}
+
+GLSurface* GLContext::GetSurface() {
+ // TODO(apatrick): Remove this when surfaces are split from contexts.
+ return NULL;
+}
+
unsigned int GLContext::GetBackingFrameBufferObject() {
return 0;
}
diff --git a/ui/gfx/gl/gl_context.h b/ui/gfx/gl/gl_context.h
index f39a77a..b27f8c9 100644
--- a/ui/gfx/gl/gl_context.h
+++ b/ui/gfx/gl/gl_context.h
@@ -14,6 +14,8 @@
namespace gfx {
+class GLSurface;
+
// Encapsulates an OpenGL context, hiding platform specific management.
class GLContext {
public:
@@ -26,6 +28,10 @@ class GLContext {
// Makes the GL context current on the current thread.
virtual bool MakeCurrent() = 0;
+ // Releases this GL context as current on the current thread. TODO(apatrick):
+ // implement this in the other GLContexts.
+ virtual void ReleaseCurrent();
+
// Returns true if this context is current.
virtual bool IsCurrent() = 0;
@@ -39,6 +45,10 @@ class GLContext {
// Get the size of the back buffer.
virtual gfx::Size GetSize() = 0;
+ // Get the surface. TODO(apatrick): remove this when contexts are split from
+ // surfaces.
+ virtual GLSurface* GetSurface();
+
// Get the underlying platform specific GL context "handle".
virtual void* GetHandle() = 0;
diff --git a/ui/gfx/gl/gl_context_egl.cc b/ui/gfx/gl/gl_context_egl.cc
index 8f64041..0093e7f 100644
--- a/ui/gfx/gl/gl_context_egl.cc
+++ b/ui/gfx/gl/gl_context_egl.cc
@@ -111,9 +111,20 @@ bool GLContextEGL::MakeCurrent() {
return true;
}
+void GLContextEGL::ReleaseCurrent() {
+ if (!IsCurrent())
+ return;
+
+ eglMakeCurrent(GLSurfaceEGL::GetDisplay(),
+ EGL_NO_SURFACE,
+ EGL_NO_SURFACE,
+ EGL_NO_CONTEXT);
+}
+
bool GLContextEGL::IsCurrent() {
DCHECK(context_);
- return context_ == eglGetCurrentContext();
+ return context_ == eglGetCurrentContext() &&
+ surface_->GetHandle() == eglGetCurrentSurface(EGL_DRAW);
}
bool GLContextEGL::IsOffscreen() {
@@ -131,6 +142,11 @@ gfx::Size GLContextEGL::GetSize() {
return surface_->GetSize();
}
+GLSurface* GLContextEGL::GetSurface() {
+ // TODO(apatrick): remove this from GLContext interface.
+ return surface_.get();
+}
+
void* GLContextEGL::GetHandle() {
return context_;
}
diff --git a/ui/gfx/gl/gl_context_egl.h b/ui/gfx/gl/gl_context_egl.h
index 43cbe922..7337d22 100644
--- a/ui/gfx/gl/gl_context_egl.h
+++ b/ui/gfx/gl/gl_context_egl.h
@@ -18,7 +18,7 @@ namespace gfx {
class GLSurfaceEGL;
-// Encapsulates an EGL OpenGL ES context that renders to a view.
+// Encapsulates an EGL OpenGL ES context.
class GLContextEGL : public GLContext {
public:
// Takes ownership of surface. TODO(apatrick): separate notion of surface
@@ -33,10 +33,12 @@ class GLContextEGL : public GLContext {
// Implement GLContext.
virtual void Destroy();
virtual bool MakeCurrent();
+ virtual void ReleaseCurrent();
virtual bool IsCurrent();
virtual bool IsOffscreen();
virtual bool SwapBuffers();
virtual gfx::Size GetSize();
+ virtual GLSurface* GetSurface();
virtual void* GetHandle();
virtual void SetSwapInterval(int interval);
virtual std::string GetExtensions();
diff --git a/ui/gfx/gl/gl_surface.h b/ui/gfx/gl/gl_surface.h
index 811b232..dde0883 100644
--- a/ui/gfx/gl/gl_surface.h
+++ b/ui/gfx/gl/gl_surface.h
@@ -19,6 +19,12 @@ class GLSurface {
GLSurface() {}
virtual ~GLSurface() {}
+ // (Re)create the surface. TODO(apatrick): This is an ugly hack to allow the
+ // EGL surface associated to be recreated without destroying the associated
+ // context. The implementation of this function for other GLSurface derived
+ // classes is in a pending changelist.
+ virtual bool Initialize() { return true; }
+
// Destroys the surface.
virtual void Destroy() = 0;