OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "cc/layers/layer.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 num_dependents_need_push_properties_(false), | 42 num_dependents_need_push_properties_(false), |
43 stacking_order_changed_(false), | 43 stacking_order_changed_(false), |
44 // Layer IDs start from 1. | 44 // Layer IDs start from 1. |
45 layer_id_(g_next_layer_id.GetNext() + 1), | 45 layer_id_(g_next_layer_id.GetNext() + 1), |
46 ignore_set_needs_commit_(false), | 46 ignore_set_needs_commit_(false), |
47 sorting_context_id_(0), | 47 sorting_context_id_(0), |
48 parent_(nullptr), | 48 parent_(nullptr), |
49 layer_tree_host_(nullptr), | 49 layer_tree_host_(nullptr), |
50 scroll_clip_layer_id_(INVALID_ID), | 50 scroll_clip_layer_id_(INVALID_ID), |
51 num_descendants_that_draw_content_(0), | 51 num_descendants_that_draw_content_(0), |
| 52 transform_tree_index_(-1), |
| 53 opacity_tree_index_(-1), |
| 54 clip_tree_index_(-1), |
52 should_scroll_on_main_thread_(false), | 55 should_scroll_on_main_thread_(false), |
53 have_wheel_event_handlers_(false), | 56 have_wheel_event_handlers_(false), |
54 have_scroll_event_handlers_(false), | 57 have_scroll_event_handlers_(false), |
55 user_scrollable_horizontal_(true), | 58 user_scrollable_horizontal_(true), |
56 user_scrollable_vertical_(true), | 59 user_scrollable_vertical_(true), |
57 is_root_for_isolated_group_(false), | 60 is_root_for_isolated_group_(false), |
58 is_container_for_fixed_position_layers_(false), | 61 is_container_for_fixed_position_layers_(false), |
59 is_drawable_(false), | 62 is_drawable_(false), |
60 draws_content_(false), | 63 draws_content_(false), |
61 hide_layer_and_subtree_(false), | 64 hide_layer_and_subtree_(false), |
62 masks_to_bounds_(false), | 65 masks_to_bounds_(false), |
63 contents_opaque_(false), | 66 contents_opaque_(false), |
64 double_sided_(true), | 67 double_sided_(true), |
65 should_flatten_transform_(true), | 68 should_flatten_transform_(true), |
66 use_parent_backface_visibility_(false), | 69 use_parent_backface_visibility_(false), |
67 draw_checkerboard_for_missing_tiles_(false), | 70 draw_checkerboard_for_missing_tiles_(false), |
68 force_render_surface_(false), | 71 force_render_surface_(false), |
69 transform_is_invertible_(true), | 72 transform_is_invertible_(true), |
| 73 has_render_surface_(false), |
70 background_color_(0), | 74 background_color_(0), |
71 opacity_(1.f), | 75 opacity_(1.f), |
72 blend_mode_(SkXfermode::kSrcOver_Mode), | 76 blend_mode_(SkXfermode::kSrcOver_Mode), |
73 scroll_parent_(nullptr), | 77 scroll_parent_(nullptr), |
74 clip_parent_(nullptr), | 78 clip_parent_(nullptr), |
75 replica_layer_(nullptr), | 79 replica_layer_(nullptr), |
76 raster_scale_(0.f), | 80 raster_scale_(0.f), |
77 client_(nullptr) { | 81 client_(nullptr) { |
78 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); | 82 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); |
79 layer_animation_controller_->AddValueObserver(this); | 83 layer_animation_controller_->AddValueObserver(this); |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 } | 1238 } |
1235 | 1239 |
1236 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 1240 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
1237 benchmark->RunOnLayer(this); | 1241 benchmark->RunOnLayer(this); |
1238 } | 1242 } |
1239 | 1243 |
1240 bool Layer::HasDelegatedContent() const { | 1244 bool Layer::HasDelegatedContent() const { |
1241 return false; | 1245 return false; |
1242 } | 1246 } |
1243 | 1247 |
| 1248 gfx::Transform Layer::screen_space_transform_from_property_trees( |
| 1249 const TransformTree& tree) const { |
| 1250 gfx::Transform xform(1, 0, 0, 1, offset_to_transform_parent().x(), |
| 1251 offset_to_transform_parent().y()); |
| 1252 if (transform_tree_index() >= 0) { |
| 1253 gfx::Transform ssxform = tree.Node(transform_tree_index())->data.to_screen; |
| 1254 xform.ConcatTransform(ssxform); |
| 1255 } |
| 1256 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); |
| 1257 return xform; |
| 1258 } |
| 1259 |
| 1260 gfx::Transform Layer::draw_transform_from_property_trees( |
| 1261 const TransformTree& tree) const { |
| 1262 gfx::Transform xform(1, 0, 0, 1, offset_to_transform_parent().x(), |
| 1263 offset_to_transform_parent().y()); |
| 1264 if (transform_tree_index() >= 0) { |
| 1265 const TransformNode* node = tree.Node(transform_tree_index()); |
| 1266 gfx::Transform ssxform; |
| 1267 tree.ComputeTransform(node->id, node->data.target_id, &ssxform); |
| 1268 xform.ConcatTransform(ssxform); |
| 1269 } |
| 1270 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); |
| 1271 return xform; |
| 1272 } |
| 1273 |
1244 } // namespace cc | 1274 } // namespace cc |
OLD | NEW |