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

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

Issue 2110683004: cc: Move filters to the effect tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 4 years, 5 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_impl.h ('k') | cc/layers/layer_impl_test_properties.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_impl.h" 5 #include "cc/layers/layer_impl.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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 layer->background_color_ = background_color_; 342 layer->background_color_ = background_color_;
343 layer->safe_opaque_background_color_ = safe_opaque_background_color_; 343 layer->safe_opaque_background_color_ = safe_opaque_background_color_;
344 layer->blend_mode_ = blend_mode_; 344 layer->blend_mode_ = blend_mode_;
345 layer->draw_blend_mode_ = draw_blend_mode_; 345 layer->draw_blend_mode_ = draw_blend_mode_;
346 layer->position_ = position_; 346 layer->position_ = position_;
347 layer->transform_ = transform_; 347 layer->transform_ = transform_;
348 layer->transform_tree_index_ = transform_tree_index_; 348 layer->transform_tree_index_ = transform_tree_index_;
349 layer->effect_tree_index_ = effect_tree_index_; 349 layer->effect_tree_index_ = effect_tree_index_;
350 layer->clip_tree_index_ = clip_tree_index_; 350 layer->clip_tree_index_ = clip_tree_index_;
351 layer->scroll_tree_index_ = scroll_tree_index_; 351 layer->scroll_tree_index_ = scroll_tree_index_;
352 layer->filters_ = filters_;
353 layer->sorting_context_id_ = sorting_context_id_; 352 layer->sorting_context_id_ = sorting_context_id_;
354 layer->has_will_change_transform_hint_ = has_will_change_transform_hint_; 353 layer->has_will_change_transform_hint_ = has_will_change_transform_hint_;
355 354
356 if (layer_property_changed_) { 355 if (layer_property_changed_) {
357 layer->layer_tree_impl()->set_needs_update_draw_properties(); 356 layer->layer_tree_impl()->set_needs_update_draw_properties();
358 layer->layer_property_changed_ = true; 357 layer->layer_property_changed_ = true;
359 } 358 }
360 359
361 // If whether layer has render surface changes, we need to update draw 360 // If whether layer has render surface changes, we need to update draw
362 // properties. 361 // properties.
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 UpdatePropertyTreeTransformIsAnimated( 588 UpdatePropertyTreeTransformIsAnimated(
590 HasPotentiallyRunningTransformAnimation()); 589 HasPotentiallyRunningTransformAnimation());
591 } 590 }
592 } 591 }
593 592
594 gfx::ScrollOffset LayerImpl::ScrollOffsetForAnimation() const { 593 gfx::ScrollOffset LayerImpl::ScrollOffsetForAnimation() const {
595 return CurrentScrollOffset(); 594 return CurrentScrollOffset();
596 } 595 }
597 596
598 void LayerImpl::OnFilterAnimated(const FilterOperations& filters) { 597 void LayerImpl::OnFilterAnimated(const FilterOperations& filters) {
599 if (filters_ != filters) { 598 layer_tree_impl()->AddToFilterAnimationsMap(id(), filters);
600 SetFilters(filters); 599 PropertyTrees* property_trees = layer_tree_impl()->property_trees();
601 SetNeedsPushProperties(); 600 DCHECK(
602 layer_tree_impl()->set_needs_update_draw_properties(); 601 property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id()));
603 EffectTree& effect_tree = layer_tree_impl()->property_trees()->effect_tree; 602 EffectNode* node = property_trees->effect_tree.Node(effect_tree_index());
604 EffectNode* node = effect_tree.Node(effect_tree_index_); 603 if (node->filters == filters)
605 DCHECK(layer_tree_impl()->property_trees()->IsInIdToIndexMap( 604 return;
606 PropertyTrees::TreeType::EFFECT, id())); 605 node->filters = filters;
607 node->effect_changed = true; 606 node->effect_changed = true;
608 layer_tree_impl()->property_trees()->changed = true; 607 property_trees->changed = true;
609 effect_tree.set_needs_update(true); 608 property_trees->effect_tree.set_needs_update(true);
610 } 609 SetNeedsPushProperties();
610 layer_tree_impl()->set_needs_update_draw_properties();
611 } 611 }
612 612
613 void LayerImpl::OnOpacityAnimated(float opacity) { 613 void LayerImpl::OnOpacityAnimated(float opacity) {
614 UpdatePropertyTreeOpacity(opacity); 614 UpdatePropertyTreeOpacity(opacity);
615 SetNeedsPushProperties(); 615 SetNeedsPushProperties();
616 layer_tree_impl()->set_needs_update_draw_properties(); 616 layer_tree_impl()->set_needs_update_draw_properties();
617 layer_tree_impl()->AddToOpacityAnimationsMap(id(), opacity); 617 layer_tree_impl()->AddToOpacityAnimationsMap(id(), opacity);
618 } 618 }
619 619
620 void LayerImpl::OnTransformAnimated(const gfx::Transform& transform) { 620 void LayerImpl::OnTransformAnimated(const gfx::Transform& transform) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 DCHECK(layer_tree_impl_); 676 DCHECK(layer_tree_impl_);
677 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); 677 PropertyTrees* property_trees = layer_tree_impl()->property_trees();
678 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) 678 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id()))
679 return; 679 return;
680 EffectNode* node = property_trees->effect_tree.Node( 680 EffectNode* node = property_trees->effect_tree.Node(
681 property_trees->effect_id_to_index_map[id()]); 681 property_trees->effect_id_to_index_map[id()]);
682 node->has_potential_opacity_animation = has_potential_animation; 682 node->has_potential_opacity_animation = has_potential_animation;
683 property_trees->effect_tree.set_needs_update(true); 683 property_trees->effect_tree.set_needs_update(true);
684 } 684 }
685 685
686 void LayerImpl::OnFilterIsCurrentlyAnimatingChanged(
687 bool is_currently_animating) {
688 DCHECK(layer_tree_impl_);
689 PropertyTrees* property_trees = layer_tree_impl()->property_trees();
690 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id()))
691 return;
692 EffectNode* node = property_trees->effect_tree.Node(
693 property_trees->effect_id_to_index_map[id()]);
694
695 node->is_currently_animating_filter = is_currently_animating;
696 }
697
698 void LayerImpl::OnFilterIsPotentiallyAnimatingChanged(
699 bool has_potential_animation) {
700 DCHECK(layer_tree_impl_);
701 PropertyTrees* property_trees = layer_tree_impl()->property_trees();
702 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id()))
703 return;
704 EffectNode* node = property_trees->effect_tree.Node(
705 property_trees->effect_id_to_index_map[id()]);
706 node->has_potential_filter_animation = has_potential_animation;
707 }
708
686 bool LayerImpl::IsActive() const { 709 bool LayerImpl::IsActive() const {
687 return layer_tree_impl_->IsActiveTree(); 710 return layer_tree_impl_->IsActiveTree();
688 } 711 }
689 712
690 gfx::Size LayerImpl::bounds() const { 713 gfx::Size LayerImpl::bounds() const {
691 gfx::Vector2d delta = gfx::ToCeiledVector2d(bounds_delta_); 714 gfx::Vector2d delta = gfx::ToCeiledVector2d(bounds_delta_);
692 return gfx::Size(bounds_.width() + delta.x(), 715 return gfx::Size(bounds_.width() + delta.x(),
693 bounds_.height() + delta.y()); 716 bounds_.height() + delta.y());
694 } 717 }
695 718
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 792
770 SkColor LayerImpl::SafeOpaqueBackgroundColor() const { 793 SkColor LayerImpl::SafeOpaqueBackgroundColor() const {
771 if (contents_opaque()) 794 if (contents_opaque())
772 return safe_opaque_background_color_; 795 return safe_opaque_background_color_;
773 SkColor color = background_color(); 796 SkColor color = background_color();
774 if (SkColorGetA(color) == 255) 797 if (SkColorGetA(color) == 255)
775 color = SK_ColorTRANSPARENT; 798 color = SK_ColorTRANSPARENT;
776 return color; 799 return color;
777 } 800 }
778 801
779 void LayerImpl::SetFilters(const FilterOperations& filters) {
780 filters_ = filters;
781 }
782
783 bool LayerImpl::FilterIsAnimating() const { 802 bool LayerImpl::FilterIsAnimating() const {
784 return GetAnimationHost()->IsAnimatingFilterProperty( 803 return GetAnimationHost()->IsAnimatingFilterProperty(
785 element_id(), GetElementTypeForAnimation()); 804 element_id(), GetElementTypeForAnimation());
786 } 805 }
787 806
788 bool LayerImpl::HasPotentiallyRunningFilterAnimation() const { 807 bool LayerImpl::HasPotentiallyRunningFilterAnimation() const {
789 return GetAnimationHost()->HasPotentiallyRunningFilterAnimation( 808 return GetAnimationHost()->HasPotentiallyRunningFilterAnimation(
790 element_id(), GetElementTypeForAnimation()); 809 element_id(), GetElementTypeForAnimation());
791 } 810 }
792 811
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 .layer_transforms_should_scale_layer_contents) { 1213 .layer_transforms_should_scale_layer_contents) {
1195 return default_scale; 1214 return default_scale;
1196 } 1215 }
1197 1216
1198 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1217 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1199 ScreenSpaceTransform(), default_scale); 1218 ScreenSpaceTransform(), default_scale);
1200 return std::max(transform_scales.x(), transform_scales.y()); 1219 return std::max(transform_scales.x(), transform_scales.y());
1201 } 1220 }
1202 1221
1203 } // namespace cc 1222 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_impl_test_properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698