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

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

Issue 1633203002: cc :: Reland compute if layer is drawn from property trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 blend_mode_(SkXfermode::kSrcOver_Mode), 93 blend_mode_(SkXfermode::kSrcOver_Mode),
94 draw_blend_mode_(SkXfermode::kSrcOver_Mode), 94 draw_blend_mode_(SkXfermode::kSrcOver_Mode),
95 scroll_parent_(nullptr), 95 scroll_parent_(nullptr),
96 layer_or_descendant_is_drawn_tracker_(0), 96 layer_or_descendant_is_drawn_tracker_(0),
97 sorted_for_recursion_tracker_(0), 97 sorted_for_recursion_tracker_(0),
98 visited_tracker_(0), 98 visited_tracker_(0),
99 clip_parent_(nullptr), 99 clip_parent_(nullptr),
100 replica_layer_(nullptr), 100 replica_layer_(nullptr),
101 client_(nullptr), 101 client_(nullptr),
102 num_unclipped_descendants_(0), 102 num_unclipped_descendants_(0),
103 frame_timing_requests_dirty_(false), 103 frame_timing_requests_dirty_(false) {
104 is_hidden_from_property_trees_(false) {
105 if (!settings.use_compositor_animation_timelines) { 104 if (!settings.use_compositor_animation_timelines) {
106 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); 105 layer_animation_controller_ = LayerAnimationController::Create(layer_id_);
107 layer_animation_controller_->AddValueObserver(this); 106 layer_animation_controller_->AddValueObserver(this);
108 layer_animation_controller_->set_value_provider(this); 107 layer_animation_controller_->set_value_provider(this);
109 } 108 }
110 } 109 }
111 110
112 Layer::~Layer() { 111 Layer::~Layer() {
113 // Our parent should be holding a reference to us so there should be no 112 // Our parent should be holding a reference to us so there should be no
114 // way for us to be destroyed while we still have a parent. 113 // way for us to be destroyed while we still have a parent.
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 } 531 }
533 532
534 void Layer::SetOpacity(float opacity) { 533 void Layer::SetOpacity(float opacity) {
535 DCHECK(IsPropertyChangeAllowed()); 534 DCHECK(IsPropertyChangeAllowed());
536 if (opacity_ == opacity) 535 if (opacity_ == opacity)
537 return; 536 return;
538 opacity_ = opacity; 537 opacity_ = opacity;
539 SetNeedsCommit(); 538 SetNeedsCommit();
540 } 539 }
541 540
541 float Layer::EffectiveOpacity() const {
542 return hide_layer_and_subtree_ ? 0.f : opacity_;
543 }
544
542 bool Layer::OpacityIsAnimating() const { 545 bool Layer::OpacityIsAnimating() const {
543 DCHECK(layer_tree_host_); 546 DCHECK(layer_tree_host_);
544 return layer_animation_controller_ 547 return layer_animation_controller_
545 ? layer_animation_controller_->IsCurrentlyAnimatingProperty( 548 ? layer_animation_controller_->IsCurrentlyAnimatingProperty(
546 Animation::OPACITY, 549 Animation::OPACITY,
547 LayerAnimationController::ObserverType::ACTIVE) 550 LayerAnimationController::ObserverType::ACTIVE)
548 : layer_tree_host_->IsAnimatingOpacityProperty(this); 551 : layer_tree_host_->IsAnimatingOpacityProperty(this);
549 } 552 }
550 553
551 bool Layer::HasPotentiallyRunningOpacityAnimation() const { 554 bool Layer::HasPotentiallyRunningOpacityAnimation() const {
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); 1237 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_);
1235 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); 1238 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly()));
1236 layer->Set3dSortingContextId(sorting_context_id_); 1239 layer->Set3dSortingContextId(sorting_context_id_);
1237 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); 1240 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_);
1238 1241
1239 layer->SetScrollClipLayer(scroll_clip_layer_id_); 1242 layer->SetScrollClipLayer(scroll_clip_layer_id_);
1240 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); 1243 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_);
1241 layer->set_user_scrollable_vertical(user_scrollable_vertical_); 1244 layer->set_user_scrollable_vertical(user_scrollable_vertical_);
1242 layer->SetElementId(element_id_); 1245 layer->SetElementId(element_id_);
1243 layer->SetMutableProperties(mutable_properties_); 1246 layer->SetMutableProperties(mutable_properties_);
1244 layer->set_is_hidden_from_property_trees(is_hidden_from_property_trees_);
1245 1247
1246 LayerImpl* scroll_parent = nullptr; 1248 LayerImpl* scroll_parent = nullptr;
1247 if (scroll_parent_) { 1249 if (scroll_parent_) {
1248 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); 1250 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id());
1249 DCHECK(scroll_parent); 1251 DCHECK(scroll_parent);
1250 } 1252 }
1251 1253
1252 layer->SetScrollParent(scroll_parent); 1254 layer->SetScrollParent(scroll_parent);
1253 if (scroll_children_) { 1255 if (scroll_children_) {
1254 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; 1256 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>;
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 this, layer_tree_host_->property_trees()->transform_tree); 2034 this, layer_tree_host_->property_trees()->transform_tree);
2033 } 2035 }
2034 2036
2035 gfx::Transform Layer::screen_space_transform() const { 2037 gfx::Transform Layer::screen_space_transform() const {
2036 DCHECK_NE(transform_tree_index_, -1); 2038 DCHECK_NE(transform_tree_index_, -1);
2037 return ScreenSpaceTransformFromPropertyTrees( 2039 return ScreenSpaceTransformFromPropertyTrees(
2038 this, layer_tree_host_->property_trees()->transform_tree); 2040 this, layer_tree_host_->property_trees()->transform_tree);
2039 } 2041 }
2040 2042
2041 } // namespace cc 2043 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698