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

Side by Side Diff: ui/gfx/gl/gl_context_egl.cc

Issue 6880218: Removed "compositor" child window that was created by the GPU process. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/gl/gl_context_egl.h ('k') | ui/gfx/gl/gl_surface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/gl/gl_context_egl.h" 5 #include "ui/gfx/gl/gl_context_egl.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "third_party/angle/include/EGL/egl.h" 10 #include "third_party/angle/include/EGL/egl.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 surface_->GetHandle(), 104 surface_->GetHandle(),
105 context_)) { 105 context_)) {
106 VLOG(1) << "eglMakeCurrent failed with error " 106 VLOG(1) << "eglMakeCurrent failed with error "
107 << GetLastEGLErrorString(); 107 << GetLastEGLErrorString();
108 return false; 108 return false;
109 } 109 }
110 110
111 return true; 111 return true;
112 } 112 }
113 113
114 void GLContextEGL::ReleaseCurrent() {
115 if (!IsCurrent())
116 return;
117
118 eglMakeCurrent(GLSurfaceEGL::GetDisplay(),
119 EGL_NO_SURFACE,
120 EGL_NO_SURFACE,
121 EGL_NO_CONTEXT);
122 }
123
114 bool GLContextEGL::IsCurrent() { 124 bool GLContextEGL::IsCurrent() {
115 DCHECK(context_); 125 DCHECK(context_);
116 return context_ == eglGetCurrentContext(); 126 return context_ == eglGetCurrentContext() &&
127 surface_->GetHandle() == eglGetCurrentSurface(EGL_DRAW);
117 } 128 }
118 129
119 bool GLContextEGL::IsOffscreen() { 130 bool GLContextEGL::IsOffscreen() {
120 // TODO(apatrick): remove this from GLContext interface. 131 // TODO(apatrick): remove this from GLContext interface.
121 return surface_->IsOffscreen(); 132 return surface_->IsOffscreen();
122 } 133 }
123 134
124 bool GLContextEGL::SwapBuffers() { 135 bool GLContextEGL::SwapBuffers() {
125 // TODO(apatrick): remove this from GLContext interface. 136 // TODO(apatrick): remove this from GLContext interface.
126 return surface_->SwapBuffers(); 137 return surface_->SwapBuffers();
127 } 138 }
128 139
129 gfx::Size GLContextEGL::GetSize() { 140 gfx::Size GLContextEGL::GetSize() {
130 // TODO(apatrick): remove this from GLContext interface. 141 // TODO(apatrick): remove this from GLContext interface.
131 return surface_->GetSize(); 142 return surface_->GetSize();
132 } 143 }
133 144
145 GLSurface* GLContextEGL::GetSurface() {
146 // TODO(apatrick): remove this from GLContext interface.
147 return surface_.get();
148 }
149
134 void* GLContextEGL::GetHandle() { 150 void* GLContextEGL::GetHandle() {
135 return context_; 151 return context_;
136 } 152 }
137 153
138 void GLContextEGL::SetSwapInterval(int interval) { 154 void GLContextEGL::SetSwapInterval(int interval) {
139 DCHECK(IsCurrent()); 155 DCHECK(IsCurrent());
140 if (!eglSwapInterval(GLSurfaceEGL::GetDisplay(), interval)) { 156 if (!eglSwapInterval(GLSurfaceEGL::GetDisplay(), interval)) {
141 LOG(ERROR) << "eglSwapInterval failed with error " 157 LOG(ERROR) << "eglSwapInterval failed with error "
142 << GetLastEGLErrorString(); 158 << GetLastEGLErrorString();
143 } 159 }
144 } 160 }
145 161
146 } // namespace gfx 162 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/gl/gl_context_egl.h ('k') | ui/gfx/gl/gl_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698