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 bool Layer::IsContextLost() { |
651 DCHECK(texture_layer_.get()); | |
652 if (texture_.get()) | 652 if (texture_.get()) |
653 return texture_->HostContext3D(); | 653 return texture_->HostContext3D()->isContextLost(); |
654 return NULL; | 654 return false; |
655 } | |
656 | |
657 void Layer::RateLimitContext() { | |
658 if (texture_.get()) | |
659 texture_->HostContext3D()->rateLimitOffscreenContextCHROMIUM(); | |
piman
2013/11/01 23:15:35
note: we don't use rate limiting for ui::Layer any
| |
655 } | 660 } |
656 | 661 |
657 bool Layer::PrepareTextureMailbox( | 662 bool Layer::PrepareTextureMailbox( |
658 cc::TextureMailbox* mailbox, | 663 cc::TextureMailbox* mailbox, |
659 scoped_ptr<cc::SingleReleaseCallback>* release_callback, | 664 scoped_ptr<cc::SingleReleaseCallback>* release_callback, |
660 bool use_shared_memory) { | 665 bool use_shared_memory) { |
661 return false; | 666 return false; |
662 } | 667 } |
663 | 668 |
664 void Layer::SetForceRenderSurface(bool force) { | 669 void Layer::SetForceRenderSurface(bool force) { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
963 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); | 968 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); |
964 } | 969 } |
965 | 970 |
966 void Layer::RecomputePosition() { | 971 void Layer::RecomputePosition() { |
967 cc_layer_->SetPosition(gfx::ScalePoint( | 972 cc_layer_->SetPosition(gfx::ScalePoint( |
968 gfx::PointF(bounds_.x(), bounds_.y()), | 973 gfx::PointF(bounds_.x(), bounds_.y()), |
969 device_scale_factor_)); | 974 device_scale_factor_)); |
970 } | 975 } |
971 | 976 |
972 } // namespace ui | 977 } // namespace ui |
OLD | NEW |