summaryrefslogtreecommitdiffstats
path: root/ui/gfx/gl/gl_surface.cc
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-26 21:44:12 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-26 21:44:12 +0000
commit1b5eee12138e3963415453974c824472429c4d80 (patch)
tree8cf1e487daea18a30d0cb23ffd2217a5b4451b6b /ui/gfx/gl/gl_surface.cc
parent703f7f4abfc6fe0859caec149c5d6fd6322bba0d (diff)
downloadchromium_src-1b5eee12138e3963415453974c824472429c4d80.zip
chromium_src-1b5eee12138e3963415453974c824472429c4d80.tar.gz
chromium_src-1b5eee12138e3963415453974c824472429c4d80.tar.bz2
Reland 107243 - Added GLSurfaceAdapter, an implementation of GLSurface that forwards all calls to another instance of GLSurface.
This is to allow new implementations of GLSurface that "derive" from different implementations selected at runtime. For example an ImageTransportSurface might derive from either GLSurfaceOSMesa or GLSurfaceGLX depending on the current GL backend in use. See http://codereview.chromium.org/8060045/. Other yak shaving includes: - Ensure no GLContext implementations do not assume that they can statically cast a GLSurface to a particular concrete type. E.g. GLContextGLX might actually be working together with a GLSurfaceAdapter derived class that delegates out to the actual GLSurfaceGLX. To that end, I made all the classes implement the likes of GetDisplay as virtuals rather than statics in the same way as we already did with GLSurfaceEGL. - Add a Resize method to GLSurfaceEGL to allow resizing of a shared pbuffer surface. - Add a method to get the D3D share handle for a PbufferGLSurfaceEGL Review URL: http://codereview.chromium.org/8390011 TBR=apatrick@chromium.org Review URL: http://codereview.chromium.org/8395027 Review URL: http://codereview.chromium.org/8394060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107433 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/gl/gl_surface.cc')
-rw-r--r--ui/gfx/gl/gl_surface.cc84
1 files changed, 84 insertions, 0 deletions
diff --git a/ui/gfx/gl/gl_surface.cc b/ui/gfx/gl/gl_surface.cc
index 868b1b29..ed849c2 100644
--- a/ui/gfx/gl/gl_surface.cc
+++ b/ui/gfx/gl/gl_surface.cc
@@ -4,6 +4,7 @@
#include "ui/gfx/gl/gl_surface.h"
+#include "base/logging.h"
#include "base/threading/thread_local.h"
#include "ui/gfx/gl/gl_context.h"
@@ -24,6 +25,11 @@ bool GLSurface::Initialize()
return true;
}
+bool GLSurface::Resize(const gfx::Size& size) {
+ NOTIMPLEMENTED();
+ return false;
+}
+
unsigned int GLSurface::GetBackingFrameBufferObject() {
return 0;
}
@@ -35,6 +41,26 @@ bool GLSurface::OnMakeCurrent(GLContext* context) {
void GLSurface::SetVisible(bool visible) {
}
+void* GLSurface::GetShareHandle() {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+void* GLSurface::GetDisplay() {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+void* GLSurface::GetConfig() {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+unsigned GLSurface::GetFormat() {
+ NOTIMPLEMENTED();
+ return 0;
+}
+
GLSurface* GLSurface::GetCurrent() {
return current_surface_.Get();
}
@@ -43,4 +69,62 @@ void GLSurface::SetCurrent(GLSurface* surface) {
current_surface_.Set(surface);
}
+GLSurfaceAdapter::GLSurfaceAdapter(GLSurface* surface) : surface_(surface) {
+}
+
+GLSurfaceAdapter::~GLSurfaceAdapter() {
+}
+
+bool GLSurfaceAdapter::Initialize() {
+ return surface_->Initialize();
+}
+
+void GLSurfaceAdapter::Destroy() {
+ surface_->Destroy();
+}
+
+bool GLSurfaceAdapter::Resize(const gfx::Size& size) {
+ return surface_->Resize(size);
+}
+
+bool GLSurfaceAdapter::IsOffscreen() {
+ return surface_->IsOffscreen();
+}
+
+bool GLSurfaceAdapter::SwapBuffers() {
+ return surface_->SwapBuffers();
+}
+
+gfx::Size GLSurfaceAdapter::GetSize() {
+ return surface_->GetSize();
+}
+
+void* GLSurfaceAdapter::GetHandle() {
+ return surface_->GetHandle();
+}
+
+unsigned int GLSurfaceAdapter::GetBackingFrameBufferObject() {
+ return surface_->GetBackingFrameBufferObject();
+}
+
+bool GLSurfaceAdapter::OnMakeCurrent(GLContext* context) {
+ return surface_->OnMakeCurrent(context);
+}
+
+void* GLSurfaceAdapter::GetShareHandle() {
+ return surface_->GetShareHandle();
+}
+
+void* GLSurfaceAdapter::GetDisplay() {
+ return surface_->GetDisplay();
+}
+
+void* GLSurfaceAdapter::GetConfig() {
+ return surface_->GetConfig();
+}
+
+unsigned GLSurfaceAdapter::GetFormat() {
+ return surface_->GetFormat();
+}
+
} // namespace gfx