| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/compositor/layer.h" | 5 #include "ui/compositor/layer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "cc/base/scoped_ptr_algorithm.h" | 13 #include "cc/base/scoped_ptr_algorithm.h" |
| 14 #include "cc/layers/content_layer.h" | 14 #include "cc/layers/content_layer.h" |
| 15 #include "cc/layers/delegated_renderer_layer.h" | 15 #include "cc/layers/delegated_renderer_layer.h" |
| 16 #include "cc/layers/solid_color_layer.h" | 16 #include "cc/layers/solid_color_layer.h" |
| 17 #include "cc/layers/texture_layer.h" | 17 #include "cc/layers/texture_layer.h" |
| 18 #include "cc/output/copy_output_request.h" | 18 #include "cc/output/copy_output_request.h" |
| 19 #include "cc/output/delegated_frame_data.h" | 19 #include "cc/output/delegated_frame_data.h" |
| 20 #include "cc/output/filter_operation.h" | 20 #include "cc/output/filter_operation.h" |
| 21 #include "cc/output/filter_operations.h" | 21 #include "cc/output/filter_operations.h" |
| 22 #include "cc/resources/transferable_resource.h" | 22 #include "cc/resources/transferable_resource.h" |
| 23 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 23 #include "ui/compositor/compositor_switches.h" | 24 #include "ui/compositor/compositor_switches.h" |
| 24 #include "ui/compositor/dip_util.h" | 25 #include "ui/compositor/dip_util.h" |
| 25 #include "ui/compositor/layer_animator.h" | 26 #include "ui/compositor/layer_animator.h" |
| 26 #include "ui/gfx/animation/animation.h" | 27 #include "ui/gfx/animation/animation.h" |
| 27 #include "ui/gfx/canvas.h" | 28 #include "ui/gfx/canvas.h" |
| 28 #include "ui/gfx/display.h" | 29 #include "ui/gfx/display.h" |
| 29 #include "ui/gfx/interpolated_transform.h" | 30 #include "ui/gfx/interpolated_transform.h" |
| 30 #include "ui/gfx/point3_f.h" | 31 #include "ui/gfx/point3_f.h" |
| 31 #include "ui/gfx/point_conversions.h" | 32 #include "ui/gfx/point_conversions.h" |
| 32 #include "ui/gfx/size_conversions.h" | 33 #include "ui/gfx/size_conversions.h" |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 delegate_->OnPaintLayer(canvas.get()); | 641 delegate_->OnPaintLayer(canvas.get()); |
| 641 if (scale_content) | 642 if (scale_content) |
| 642 canvas->Restore(); | 643 canvas->Restore(); |
| 643 } | 644 } |
| 644 | 645 |
| 645 unsigned Layer::PrepareTexture() { | 646 unsigned Layer::PrepareTexture() { |
| 646 DCHECK(texture_layer_.get()); | 647 DCHECK(texture_layer_.get()); |
| 647 return texture_->PrepareTexture(); | 648 return texture_->PrepareTexture(); |
| 648 } | 649 } |
| 649 | 650 |
| 650 WebKit::WebGraphicsContext3D* Layer::Context3d() { | |
| 651 DCHECK(texture_layer_.get()); | |
| 652 if (texture_.get()) | |
| 653 return texture_->HostContext3D(); | |
| 654 return NULL; | |
| 655 } | |
| 656 | |
| 657 bool Layer::PrepareTextureMailbox( | 651 bool Layer::PrepareTextureMailbox( |
| 658 cc::TextureMailbox* mailbox, | 652 cc::TextureMailbox* mailbox, |
| 659 scoped_ptr<cc::SingleReleaseCallback>* release_callback, | 653 scoped_ptr<cc::SingleReleaseCallback>* release_callback, |
| 660 bool use_shared_memory) { | 654 bool use_shared_memory) { |
| 661 return false; | 655 return false; |
| 662 } | 656 } |
| 663 | 657 |
| 664 void Layer::SetForceRenderSurface(bool force) { | 658 void Layer::SetForceRenderSurface(bool force) { |
| 665 if (force_render_surface_ == force) | 659 if (force_render_surface_ == force) |
| 666 return; | 660 return; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); | 957 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); |
| 964 } | 958 } |
| 965 | 959 |
| 966 void Layer::RecomputePosition() { | 960 void Layer::RecomputePosition() { |
| 967 cc_layer_->SetPosition(gfx::ScalePoint( | 961 cc_layer_->SetPosition(gfx::ScalePoint( |
| 968 gfx::PointF(bounds_.x(), bounds_.y()), | 962 gfx::PointF(bounds_.x(), bounds_.y()), |
| 969 device_scale_factor_)); | 963 device_scale_factor_)); |
| 970 } | 964 } |
| 971 | 965 |
| 972 } // namespace ui | 966 } // namespace ui |
| OLD | NEW |