Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: cc/layers/layer.cc

Issue 687873004: Introduce Property Trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wip-awoloszyn2
Patch Set: ComputeTransform now inits result to identity. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 should_render_to_separate_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 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 DCHECK_GE(num_descendants_that_draw_content_, 0); 1230 DCHECK_GE(num_descendants_that_draw_content_, 0);
1227 DCHECK_GE(num_descendants_that_draw_content_ + num, 0); 1231 DCHECK_GE(num_descendants_that_draw_content_ + num, 0);
1228 if (num == 0) 1232 if (num == 0)
1229 return; 1233 return;
1230 num_descendants_that_draw_content_ += num; 1234 num_descendants_that_draw_content_ += num;
1231 SetNeedsCommit(); 1235 SetNeedsCommit();
1232 if (parent()) 1236 if (parent())
1233 parent()->AddDrawableDescendants(num); 1237 parent()->AddDrawableDescendants(num);
1234 } 1238 }
1235 1239
1240 bool Layer::NeedsVisibleRectUpdated() const {
1241 return DrawsContent();
1242 }
1243
1236 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { 1244 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) {
1237 benchmark->RunOnLayer(this); 1245 benchmark->RunOnLayer(this);
1238 } 1246 }
1239 1247
1240 bool Layer::HasDelegatedContent() const { 1248 bool Layer::HasDelegatedContent() const {
1241 return false; 1249 return false;
1242 } 1250 }
1243 1251
1252 gfx::Transform Layer::screen_space_transform_from_property_trees(
1253 const TransformTree& tree) const {
1254 gfx::Transform xform(1, 0, 0, 1, offset_to_transform_parent().x(),
1255 offset_to_transform_parent().y());
1256 if (transform_tree_index() >= 0) {
1257 gfx::Transform ssxform = tree.Node(transform_tree_index())->data.to_screen;
1258 xform.ConcatTransform(ssxform);
1259 }
1260 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y());
1261 return xform;
1262 }
1263
1264 gfx::Transform Layer::draw_transform_from_property_trees(
1265 const TransformTree& tree) const {
1266 gfx::Transform xform(1, 0, 0, 1, offset_to_transform_parent().x(),
1267 offset_to_transform_parent().y());
1268 if (transform_tree_index() >= 0) {
1269 const TransformNode* node = tree.Node(transform_tree_index());
1270 gfx::Transform ssxform;
1271 tree.ComputeTransform(node->id, node->data.target_id, &ssxform);
1272 xform.ConcatTransform(ssxform);
1273 }
1274 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y());
1275 return xform;
1276 }
1277
1244 } // namespace cc 1278 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698