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

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

Issue 7770002: gfx::Compositor: SchedulePaint. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 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/compositor/compositor_gl.h ('k') | ui/gfx/compositor/compositor_win.cc » ('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/compositor/compositor_gl.h" 5 #include "ui/gfx/compositor/compositor_gl.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 glVertexAttribPointer(program.a_tex_loc(), 2, GL_FLOAT, 434 glVertexAttribPointer(program.a_tex_loc(), 2, GL_FLOAT,
435 GL_FALSE, 2 * sizeof(GLfloat), texture_vertices); 435 GL_FALSE, 2 * sizeof(GLfloat), texture_vertices);
436 glEnableVertexAttribArray(program.a_pos_loc()); 436 glEnableVertexAttribArray(program.a_pos_loc());
437 glEnableVertexAttribArray(program.a_tex_loc()); 437 glEnableVertexAttribArray(program.a_tex_loc());
438 438
439 glUniformMatrix4fv(program.u_mat_loc(), 1, GL_FALSE, m); 439 glUniformMatrix4fv(program.u_mat_loc(), 1, GL_FALSE, m);
440 440
441 glDrawArrays(GL_TRIANGLE_FAN, 0, 4); 441 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
442 } 442 }
443 443
444 CompositorGL::CompositorGL(gfx::AcceleratedWidget widget, 444 CompositorGL::CompositorGL(CompositorDelegate* delegate,
445 gfx::AcceleratedWidget widget,
445 const gfx::Size& size) 446 const gfx::Size& size)
446 : Compositor(size), 447 : Compositor(delegate, size),
447 started_(false) { 448 started_(false) {
448 gl_surface_ = gfx::GLSurface::CreateViewGLSurface(false, widget); 449 gl_surface_ = gfx::GLSurface::CreateViewGLSurface(false, widget);
449 gl_context_ = SharedResources::GetInstance()-> 450 gl_context_ = SharedResources::GetInstance()->
450 CreateContext(gl_surface_.get()); 451 CreateContext(gl_surface_.get());
451 gl_context_->MakeCurrent(gl_surface_.get()); 452 gl_context_->MakeCurrent(gl_surface_.get());
452 glColorMask(true, true, true, true); 453 glColorMask(true, true, true, true);
453 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 454 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
454 } 455 }
455 456
456 CompositorGL::~CompositorGL() { 457 CompositorGL::~CompositorGL() {
(...skipping 29 matching lines...) Expand all
486 void CompositorGL::NotifyEnd() { 487 void CompositorGL::NotifyEnd() {
487 DCHECK(started_); 488 DCHECK(started_);
488 gl_surface_->SwapBuffers(); 489 gl_surface_->SwapBuffers();
489 started_ = false; 490 started_ = false;
490 } 491 }
491 492
492 void CompositorGL::Blur(const gfx::Rect& bounds) { 493 void CompositorGL::Blur(const gfx::Rect& bounds) {
493 NOTIMPLEMENTED(); 494 NOTIMPLEMENTED();
494 } 495 }
495 496
496 void CompositorGL::SchedulePaint() {
497 // TODO: X doesn't provide coalescing of regions, its left to the toolkit.
498 NOTIMPLEMENTED();
499 }
500
501 // static 497 // static
502 Compositor* Compositor::Create(gfx::AcceleratedWidget widget, 498 Compositor* Compositor::Create(CompositorDelegate* owner,
499 gfx::AcceleratedWidget widget,
503 const gfx::Size& size) { 500 const gfx::Size& size) {
504 if (SharedResources::GetInstance() == NULL) 501 if (SharedResources::GetInstance() == NULL)
505 return NULL; 502 return NULL;
506 else 503 else
507 return new CompositorGL(widget, size); 504 return new CompositorGL(owner, widget, size);
508 } 505 }
509 506
510 } // namespace ui 507 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/compositor/compositor_gl.h ('k') | ui/gfx/compositor/compositor_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698