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

Side by Side Diff: ui/gfx/compositor/compositor_gl.cc

Issue 7064026: Changes to reflect gontext/surface refactoring for new compositor. (Closed) Base URL: svn://svn.chromium.org/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 | « no previous file | no next file » | 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/compositor/compositor.h" 5 #include "ui/gfx/compositor/compositor.h"
6 6
7 #include <GL/gl.h> 7 #include <GL/gl.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 if (!t.matrix().isIdentity()) { 188 if (!t.matrix().isIdentity()) {
189 glLoadIdentity(); 189 glLoadIdentity();
190 } 190 }
191 191
192 glDisable(GL_TEXTURE_2D); 192 glDisable(GL_TEXTURE_2D);
193 } 193 }
194 194
195 CompositorGL::CompositorGL(gfx::AcceleratedWidget widget) 195 CompositorGL::CompositorGL(gfx::AcceleratedWidget widget)
196 : started_(false) { 196 : started_(false) {
197 gl_surface_.reset(gfx::GLSurface::CreateViewGLSurface(widget)); 197 gl_surface_.reset(gfx::GLSurface::CreateViewGLSurface(widget));
198 gl_context_.reset(gfx::GLContext::CreateGLContext(NULL, gl_surface.get())), 198 gl_context_.reset(gfx::GLContext::CreateGLContext(NULL, gl_surface_.get())),
199 gl_context_->MakeCurrent(); 199 gl_context_->MakeCurrent(gl_surface_.get());
200 glColorMask(true, true, true, true); 200 glColorMask(true, true, true, true);
201 glEnable(GL_BLEND); 201 glEnable(GL_BLEND);
202 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 202 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
203 } 203 }
204 204
205 CompositorGL::~CompositorGL() { 205 CompositorGL::~CompositorGL() {
206 } 206 }
207 207
208 void CompositorGL::MakeCurrent() { 208 void CompositorGL::MakeCurrent() {
209 gl_context_->MakeCurrent(); 209 gl_context_->MakeCurrent(gl_surface_.get());
210 } 210 }
211 211
212 gfx::Size CompositorGL::GetSize() { 212 gfx::Size CompositorGL::GetSize() {
213 return gl_context_->GetSize(); 213 return gl_surface_->GetSize();
214 } 214 }
215 215
216 Texture* CompositorGL::CreateTexture() { 216 Texture* CompositorGL::CreateTexture() {
217 Texture* texture = new TextureGL(this); 217 Texture* texture = new TextureGL(this);
218 return texture; 218 return texture;
219 } 219 }
220 220
221 void CompositorGL::NotifyStart() { 221 void CompositorGL::NotifyStart() {
222 started_ = true; 222 started_ = true;
223 gl_context_->MakeCurrent(gl_surface_.get()); 223 gl_context_->MakeCurrent(gl_surface_.get());
224 glViewport(0, 0, 224 glViewport(0, 0,
225 gl_context_->GetSize().width(), gl_context_->GetSize().height()); 225 gl_surface_->GetSize().width(), gl_surface_->GetSize().height());
226 226
227 // Clear to 'psychedelic' purple to make it easy to spot un-rendered regions. 227 // Clear to 'psychedelic' purple to make it easy to spot un-rendered regions.
228 glClearColor(223.0 / 255, 0, 1, 1); 228 glClearColor(223.0 / 255, 0, 1, 1);
229 glColorMask(true, true, true, true); 229 glColorMask(true, true, true, true);
230 glClear(GL_COLOR_BUFFER_BIT); 230 glClear(GL_COLOR_BUFFER_BIT);
231 // Disable alpha writes, since we're using blending anyways. 231 // Disable alpha writes, since we're using blending anyways.
232 glColorMask(true, true, true, false); 232 glColorMask(true, true, true, false);
233 } 233 }
234 234
235 void CompositorGL::NotifyEnd() { 235 void CompositorGL::NotifyEnd() {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 313
314 // static 314 // static
315 Compositor* Compositor::Create(gfx::AcceleratedWidget widget) { 315 Compositor* Compositor::Create(gfx::AcceleratedWidget widget) {
316 if (gfx::GetGLImplementation() != gfx::kGLImplementationNone) 316 if (gfx::GetGLImplementation() != gfx::kGLImplementationNone)
317 return new CompositorGL(widget); 317 return new CompositorGL(widget);
318 return NULL; 318 return NULL;
319 } 319 }
320 #endif 320 #endif
321 321
322 } // namespace ui 322 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698