| 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 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 17 #include "cc/layers/nine_patch_layer.h" | 17 #include "cc/layers/nine_patch_layer.h" |
| 18 #include "cc/layers/picture_layer.h" | 18 #include "cc/layers/picture_layer.h" |
| 19 #include "cc/layers/solid_color_layer.h" | 19 #include "cc/layers/solid_color_layer.h" |
| 20 #include "cc/layers/surface_layer.h" | 20 #include "cc/layers/surface_layer.h" |
| 21 #include "cc/layers/texture_layer.h" | 21 #include "cc/layers/texture_layer.h" |
| 22 #include "cc/output/copy_output_request.h" | 22 #include "cc/output/copy_output_request.h" |
| 23 #include "cc/output/filter_operation.h" | 23 #include "cc/output/filter_operation.h" |
| 24 #include "cc/output/filter_operations.h" | 24 #include "cc/output/filter_operations.h" |
| 25 #include "cc/playback/display_item_list_settings.h" | 25 #include "cc/playback/display_item_list_settings.h" |
| 26 #include "cc/resources/transferable_resource.h" | 26 #include "cc/resources/transferable_resource.h" |
| 27 #include "cc/trees/element_id.h" |
| 27 #include "cc/trees/layer_tree_settings.h" | 28 #include "cc/trees/layer_tree_settings.h" |
| 28 #include "ui/compositor/compositor_switches.h" | 29 #include "ui/compositor/compositor_switches.h" |
| 29 #include "ui/compositor/dip_util.h" | 30 #include "ui/compositor/dip_util.h" |
| 30 #include "ui/compositor/layer_animator.h" | 31 #include "ui/compositor/layer_animator.h" |
| 31 #include "ui/compositor/paint_context.h" | 32 #include "ui/compositor/paint_context.h" |
| 32 #include "ui/gfx/animation/animation.h" | 33 #include "ui/gfx/animation/animation.h" |
| 33 #include "ui/gfx/canvas.h" | 34 #include "ui/gfx/canvas.h" |
| 34 #include "ui/gfx/geometry/point3_f.h" | 35 #include "ui/gfx/geometry/point3_f.h" |
| 35 #include "ui/gfx/geometry/point_conversions.h" | 36 #include "ui/gfx/geometry/point_conversions.h" |
| 36 #include "ui/gfx/geometry/size_conversions.h" | 37 #include "ui/gfx/geometry/size_conversions.h" |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 if (type_ == LAYER_SOLID_COLOR) { | 957 if (type_ == LAYER_SOLID_COLOR) { |
| 957 solid_color_layer_ = cc::SolidColorLayer::Create(); | 958 solid_color_layer_ = cc::SolidColorLayer::Create(); |
| 958 cc_layer_ = solid_color_layer_.get(); | 959 cc_layer_ = solid_color_layer_.get(); |
| 959 } else if (type_ == LAYER_NINE_PATCH) { | 960 } else if (type_ == LAYER_NINE_PATCH) { |
| 960 nine_patch_layer_ = cc::NinePatchLayer::Create(); | 961 nine_patch_layer_ = cc::NinePatchLayer::Create(); |
| 961 cc_layer_ = nine_patch_layer_.get(); | 962 cc_layer_ = nine_patch_layer_.get(); |
| 962 } else { | 963 } else { |
| 963 content_layer_ = cc::PictureLayer::Create(this); | 964 content_layer_ = cc::PictureLayer::Create(this); |
| 964 cc_layer_ = content_layer_.get(); | 965 cc_layer_ = content_layer_.get(); |
| 965 } | 966 } |
| 967 cc_layer_->SetElementId(cc::NextElementId()); |
| 966 cc_layer_->SetTransformOrigin(gfx::Point3F()); | 968 cc_layer_->SetTransformOrigin(gfx::Point3F()); |
| 967 cc_layer_->SetContentsOpaque(true); | 969 cc_layer_->SetContentsOpaque(true); |
| 968 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); | 970 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); |
| 969 cc_layer_->SetLayerClient(this); | 971 cc_layer_->SetLayerClient(this); |
| 970 RecomputePosition(); | 972 RecomputePosition(); |
| 971 } | 973 } |
| 972 | 974 |
| 973 gfx::Transform Layer::transform() const { | 975 gfx::Transform Layer::transform() const { |
| 974 return cc_layer_->transform(); | 976 return cc_layer_->transform(); |
| 975 } | 977 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 if (animator_) { | 1018 if (animator_) { |
| 1017 animator_->ResetCompositor(compositor); | 1019 animator_->ResetCompositor(compositor); |
| 1018 animator_->RemoveFromCollection(collection); | 1020 animator_->RemoveFromCollection(collection); |
| 1019 } | 1021 } |
| 1020 | 1022 |
| 1021 for (auto* child : children_) | 1023 for (auto* child : children_) |
| 1022 child->ResetCompositorForAnimatorsInTree(compositor); | 1024 child->ResetCompositorForAnimatorsInTree(compositor); |
| 1023 } | 1025 } |
| 1024 | 1026 |
| 1025 } // namespace ui | 1027 } // namespace ui |
| OLD | NEW |