| 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), |
| (...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 DCHECK_GE(num_descendants_that_draw_content_, 0); | 1229 DCHECK_GE(num_descendants_that_draw_content_, 0); |
| 1227 DCHECK_GE(num_descendants_that_draw_content_ + num, 0); | 1230 DCHECK_GE(num_descendants_that_draw_content_ + num, 0); |
| 1228 if (num == 0) | 1231 if (num == 0) |
| 1229 return; | 1232 return; |
| 1230 num_descendants_that_draw_content_ += num; | 1233 num_descendants_that_draw_content_ += num; |
| 1231 SetNeedsCommit(); | 1234 SetNeedsCommit(); |
| 1232 if (parent()) | 1235 if (parent()) |
| 1233 parent()->AddDrawableDescendants(num); | 1236 parent()->AddDrawableDescendants(num); |
| 1234 } | 1237 } |
| 1235 | 1238 |
| 1239 bool Layer::NeedsVisibleRectUpdated() const { |
| 1240 return DrawsContent(); |
| 1241 } |
| 1242 |
| 1236 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 1243 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 1237 benchmark->RunOnLayer(this); | 1244 benchmark->RunOnLayer(this); |
| 1238 } | 1245 } |
| 1239 | 1246 |
| 1240 bool Layer::HasDelegatedContent() const { | 1247 bool Layer::HasDelegatedContent() const { |
| 1241 return false; | 1248 return false; |
| 1242 } | 1249 } |
| 1243 | 1250 |
| 1251 gfx::Transform Layer::debug_screen_space_transform( |
| 1252 const TransformTree& tree) const { |
| 1253 gfx::Transform xform(1, 0, 0, 1, offset_to_transform_parent().x(), |
| 1254 offset_to_transform_parent().y()); |
| 1255 if (transform_tree_index() >= 0) { |
| 1256 gfx::Transform ssxform = tree.Node(transform_tree_index())->data.to_screen; |
| 1257 xform.ConcatTransform(ssxform); |
| 1258 } |
| 1259 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); |
| 1260 return xform; |
| 1261 } |
| 1262 |
| 1263 gfx::Transform Layer::debug_draw_transform(const TransformTree& tree) const { |
| 1264 if (!has_render_target()) |
| 1265 return debug_screen_space_transform(tree); |
| 1266 |
| 1267 gfx::Transform xform(1, 0, 0, 1, offset_to_transform_parent().x(), |
| 1268 offset_to_transform_parent().y()); |
| 1269 if (transform_tree_index() >= 0) { |
| 1270 gfx::Transform ssxform; |
| 1271 ComputeTransform(tree, transform_tree_index(), |
| 1272 render_target()->transform_tree_index(), &ssxform); |
| 1273 xform.ConcatTransform(ssxform); |
| 1274 } |
| 1275 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); |
| 1276 return xform; |
| 1277 } |
| 1278 |
| 1244 } // namespace cc | 1279 } // namespace cc |
| OLD | NEW |