| Index: ui/gfx/gl/gl_context_egl.cc
|
| ===================================================================
|
| --- ui/gfx/gl/gl_context_egl.cc (revision 85357)
|
| +++ ui/gfx/gl/gl_context_egl.cc (working copy)
|
| @@ -32,9 +32,8 @@
|
| return GLContext::GetExtensions() + " " + extensions;
|
| }
|
|
|
| -GLContextEGL::GLContextEGL(GLSurfaceEGL* surface)
|
| - : surface_(surface),
|
| - context_(NULL)
|
| +GLContextEGL::GLContextEGL()
|
| + : context_(NULL)
|
| {
|
| }
|
|
|
| @@ -62,18 +61,6 @@
|
| return false;
|
| }
|
|
|
| - if (!MakeCurrent()) {
|
| - LOG(ERROR) << "MakeCurrent failed.";
|
| - Destroy();
|
| - return false;
|
| - }
|
| -
|
| - if (!InitializeCommon()) {
|
| - LOG(ERROR) << "GLContext::InitializeCommon failed.";
|
| - Destroy();
|
| - return false;
|
| - }
|
| -
|
| return true;
|
| }
|
|
|
| @@ -86,21 +73,16 @@
|
|
|
| context_ = NULL;
|
| }
|
| -
|
| - if (surface_.get()) {
|
| - surface_->Destroy();
|
| - surface_.reset();
|
| - }
|
| }
|
|
|
| -bool GLContextEGL::MakeCurrent() {
|
| +bool GLContextEGL::MakeCurrent(GLSurface* surface) {
|
| DCHECK(context_);
|
| - if (IsCurrent())
|
| + if (IsCurrent(surface))
|
| return true;
|
|
|
| if (!eglMakeCurrent(GLSurfaceEGL::GetDisplay(),
|
| - surface_->GetHandle(),
|
| - surface_->GetHandle(),
|
| + surface->GetHandle(),
|
| + surface->GetHandle(),
|
| context_)) {
|
| VLOG(1) << "eglMakeCurrent failed with error "
|
| << GetLastEGLErrorString();
|
| @@ -110,8 +92,8 @@
|
| return true;
|
| }
|
|
|
| -void GLContextEGL::ReleaseCurrent() {
|
| - if (!IsCurrent())
|
| +void GLContextEGL::ReleaseCurrent(GLSurface* surface) {
|
| + if (!IsCurrent(surface))
|
| return;
|
|
|
| eglMakeCurrent(GLSurfaceEGL::GetDisplay(),
|
| @@ -120,38 +102,25 @@
|
| EGL_NO_CONTEXT);
|
| }
|
|
|
| -bool GLContextEGL::IsCurrent() {
|
| +bool GLContextEGL::IsCurrent(GLSurface* surface) {
|
| DCHECK(context_);
|
| - return context_ == eglGetCurrentContext() &&
|
| - surface_->GetHandle() == eglGetCurrentSurface(EGL_DRAW);
|
| -}
|
| + if (context_ != eglGetCurrentContext())
|
| + return false;
|
|
|
| -bool GLContextEGL::IsOffscreen() {
|
| - // TODO(apatrick): remove this from GLContext interface.
|
| - return surface_->IsOffscreen();
|
| -}
|
| + if (surface) {
|
| + if (surface->GetHandle() != eglGetCurrentSurface(EGL_DRAW))
|
| + return false;
|
| + }
|
|
|
| -bool GLContextEGL::SwapBuffers() {
|
| - // TODO(apatrick): remove this from GLContext interface.
|
| - return surface_->SwapBuffers();
|
| + return true;
|
| }
|
|
|
| -gfx::Size GLContextEGL::GetSize() {
|
| - // TODO(apatrick): remove this from GLContext interface.
|
| - return surface_->GetSize();
|
| -}
|
| -
|
| -GLSurface* GLContextEGL::GetSurface() {
|
| - // TODO(apatrick): remove this from GLContext interface.
|
| - return surface_.get();
|
| -}
|
| -
|
| void* GLContextEGL::GetHandle() {
|
| return context_;
|
| }
|
|
|
| void GLContextEGL::SetSwapInterval(int interval) {
|
| - DCHECK(IsCurrent());
|
| + DCHECK(IsCurrent(NULL));
|
| if (!eglSwapInterval(GLSurfaceEGL::GetDisplay(), interval)) {
|
| LOG(ERROR) << "eglSwapInterval failed with error "
|
| << GetLastEGLErrorString();
|
|
|