OLD | NEW |
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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 } | 466 } |
467 | 467 |
468 void CompositorGL::OnWidgetSizeChanged() { | 468 void CompositorGL::OnWidgetSizeChanged() { |
469 } | 469 } |
470 | 470 |
471 Texture* CompositorGL::CreateTexture() { | 471 Texture* CompositorGL::CreateTexture() { |
472 Texture* texture = new TextureGL(); | 472 Texture* texture = new TextureGL(); |
473 return texture; | 473 return texture; |
474 } | 474 } |
475 | 475 |
476 void CompositorGL::NotifyStart() { | 476 void CompositorGL::OnNotifyStart() { |
477 started_ = true; | 477 started_ = true; |
478 gl_context_->MakeCurrent(gl_surface_.get()); | 478 gl_context_->MakeCurrent(gl_surface_.get()); |
479 glViewport(0, 0, size().width(), size().height()); | 479 glViewport(0, 0, size().width(), size().height()); |
480 glColorMask(true, true, true, true); | 480 glColorMask(true, true, true, true); |
481 | 481 |
482 #if defined(DEBUG) | 482 #if defined(DEBUG) |
483 // Clear to 'psychedelic' purple to make it easy to spot un-rendered regions. | 483 // Clear to 'psychedelic' purple to make it easy to spot un-rendered regions. |
484 glClearColor(223.0 / 255, 0, 1, 1); | 484 glClearColor(223.0 / 255, 0, 1, 1); |
485 glClear(GL_COLOR_BUFFER_BIT); | 485 glClear(GL_COLOR_BUFFER_BIT); |
486 #endif | 486 #endif |
487 // Do not clear in release: root layer is responsible for drawing every pixel. | 487 // Do not clear in release: root layer is responsible for drawing every pixel. |
488 } | 488 } |
489 | 489 |
490 void CompositorGL::NotifyEnd() { | 490 void CompositorGL::OnNotifyEnd() { |
491 DCHECK(started_); | 491 DCHECK(started_); |
492 gl_surface_->SwapBuffers(); | 492 gl_surface_->SwapBuffers(); |
493 started_ = false; | 493 started_ = false; |
494 } | 494 } |
495 | 495 |
496 void CompositorGL::Blur(const gfx::Rect& bounds) { | 496 void CompositorGL::Blur(const gfx::Rect& bounds) { |
497 NOTIMPLEMENTED(); | 497 NOTIMPLEMENTED(); |
498 } | 498 } |
499 | 499 |
500 void CompositorGL::SchedulePaint() { | 500 void CompositorGL::SchedulePaint() { |
501 // TODO: X doesn't provide coalescing of regions, its left to the toolkit. | 501 // TODO: X doesn't provide coalescing of regions, its left to the toolkit. |
502 NOTIMPLEMENTED(); | 502 NOTIMPLEMENTED(); |
503 } | 503 } |
504 | 504 |
505 // static | 505 // static |
506 Compositor* Compositor::Create(gfx::AcceleratedWidget widget, | 506 Compositor* Compositor::Create(gfx::AcceleratedWidget widget, |
507 const gfx::Size& size) { | 507 const gfx::Size& size) { |
508 if (SharedResources::GetInstance() == NULL) | 508 if (SharedResources::GetInstance() == NULL) |
509 return NULL; | 509 return NULL; |
510 else | 510 else |
511 return new CompositorGL(widget, size); | 511 return new CompositorGL(widget, size); |
512 } | 512 } |
513 | 513 |
514 } // namespace ui | 514 } // namespace ui |
OLD | NEW |