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

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

Issue 1588093004: Compute if a layer is drawn without LayerTree hierarchy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 blend_mode_(SkXfermode::kSrcOver_Mode), 91 blend_mode_(SkXfermode::kSrcOver_Mode),
92 draw_blend_mode_(SkXfermode::kSrcOver_Mode), 92 draw_blend_mode_(SkXfermode::kSrcOver_Mode),
93 scroll_parent_(nullptr), 93 scroll_parent_(nullptr),
94 layer_or_descendant_is_drawn_tracker_(0), 94 layer_or_descendant_is_drawn_tracker_(0),
95 sorted_for_recursion_tracker_(0), 95 sorted_for_recursion_tracker_(0),
96 visited_tracker_(0), 96 visited_tracker_(0),
97 clip_parent_(nullptr), 97 clip_parent_(nullptr),
98 replica_layer_(nullptr), 98 replica_layer_(nullptr),
99 client_(nullptr), 99 client_(nullptr),
100 num_unclipped_descendants_(0), 100 num_unclipped_descendants_(0),
101 frame_timing_requests_dirty_(false), 101 frame_timing_requests_dirty_(false) {
102 is_hidden_from_property_trees_(false) {
103 if (!settings.use_compositor_animation_timelines) { 102 if (!settings.use_compositor_animation_timelines) {
104 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); 103 layer_animation_controller_ = LayerAnimationController::Create(layer_id_);
105 layer_animation_controller_->AddValueObserver(this); 104 layer_animation_controller_->AddValueObserver(this);
106 layer_animation_controller_->set_value_provider(this); 105 layer_animation_controller_->set_value_provider(this);
107 } 106 }
108 } 107 }
109 108
110 Layer::~Layer() { 109 Layer::~Layer() {
111 // Our parent should be holding a reference to us so there should be no 110 // Our parent should be holding a reference to us so there should be no
112 // way for us to be destroyed while we still have a parent. 111 // way for us to be destroyed while we still have a parent.
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 529 }
531 530
532 void Layer::SetOpacity(float opacity) { 531 void Layer::SetOpacity(float opacity) {
533 DCHECK(IsPropertyChangeAllowed()); 532 DCHECK(IsPropertyChangeAllowed());
534 if (opacity_ == opacity) 533 if (opacity_ == opacity)
535 return; 534 return;
536 opacity_ = opacity; 535 opacity_ = opacity;
537 SetNeedsCommit(); 536 SetNeedsCommit();
538 } 537 }
539 538
539 float Layer::EffectiveOpacity() const {
540 return hide_layer_and_subtree_ ? 0.f : opacity_;
541 }
542
540 bool Layer::OpacityIsAnimating() const { 543 bool Layer::OpacityIsAnimating() const {
541 DCHECK(layer_tree_host_); 544 DCHECK(layer_tree_host_);
542 return layer_animation_controller_ 545 return layer_animation_controller_
543 ? layer_animation_controller_->IsCurrentlyAnimatingProperty( 546 ? layer_animation_controller_->IsCurrentlyAnimatingProperty(
544 Animation::OPACITY, 547 Animation::OPACITY,
545 LayerAnimationController::ObserverType::ACTIVE) 548 LayerAnimationController::ObserverType::ACTIVE)
546 : layer_tree_host_->IsAnimatingOpacityProperty(this); 549 : layer_tree_host_->IsAnimatingOpacityProperty(this);
547 } 550 }
548 551
549 bool Layer::HasPotentiallyRunningOpacityAnimation() const { 552 bool Layer::HasPotentiallyRunningOpacityAnimation() const {
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); 1234 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_);
1232 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); 1235 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly()));
1233 layer->Set3dSortingContextId(sorting_context_id_); 1236 layer->Set3dSortingContextId(sorting_context_id_);
1234 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); 1237 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_);
1235 1238
1236 layer->SetScrollClipLayer(scroll_clip_layer_id_); 1239 layer->SetScrollClipLayer(scroll_clip_layer_id_);
1237 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); 1240 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_);
1238 layer->set_user_scrollable_vertical(user_scrollable_vertical_); 1241 layer->set_user_scrollable_vertical(user_scrollable_vertical_);
1239 layer->SetElementId(element_id_); 1242 layer->SetElementId(element_id_);
1240 layer->SetMutableProperties(mutable_properties_); 1243 layer->SetMutableProperties(mutable_properties_);
1241 layer->set_is_hidden_from_property_trees(is_hidden_from_property_trees_);
1242 1244
1243 LayerImpl* scroll_parent = nullptr; 1245 LayerImpl* scroll_parent = nullptr;
1244 if (scroll_parent_) { 1246 if (scroll_parent_) {
1245 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); 1247 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id());
1246 DCHECK(scroll_parent); 1248 DCHECK(scroll_parent);
1247 } 1249 }
1248 1250
1249 layer->SetScrollParent(scroll_parent); 1251 layer->SetScrollParent(scroll_parent);
1250 if (scroll_children_) { 1252 if (scroll_children_) {
1251 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; 1253 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>;
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 this, layer_tree_host_->property_trees()->transform_tree); 2033 this, layer_tree_host_->property_trees()->transform_tree);
2032 } 2034 }
2033 2035
2034 gfx::Transform Layer::screen_space_transform() const { 2036 gfx::Transform Layer::screen_space_transform() const {
2035 DCHECK_NE(transform_tree_index_, -1); 2037 DCHECK_NE(transform_tree_index_, -1);
2036 return ScreenSpaceTransformFromPropertyTrees( 2038 return ScreenSpaceTransformFromPropertyTrees(
2037 this, layer_tree_host_->property_trees()->transform_tree); 2039 this, layer_tree_host_->property_trees()->transform_tree);
2038 } 2040 }
2039 2041
2040 } // namespace cc 2042 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698