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

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

Issue 2273933002: cc : Delete LayerImpl::OnOpacityAnimated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 4 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/trees/layer_tree_host_common_unittest.cc » ('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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 } else { 550 } else {
551 node->has_only_translation_animations = true; 551 node->has_only_translation_animations = true;
552 } 552 }
553 553
554 property_trees->transform_tree.set_needs_update(true); 554 property_trees->transform_tree.set_needs_update(true);
555 layer_tree_impl()->set_needs_update_draw_properties(); 555 layer_tree_impl()->set_needs_update_draw_properties();
556 } 556 }
557 } 557 }
558 } 558 }
559 559
560 void LayerImpl::UpdatePropertyTreeOpacity(float opacity) {
561 PropertyTrees* property_trees = layer_tree_impl()->property_trees();
562 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) {
563 // A LayerImpl's own current state is insufficient for determining whether
564 // it owns an OpacityNode, since this depends on the state of the
565 // corresponding Layer at the time of the last commit. For example, an
566 // opacity animation might have been in progress at the time the last commit
567 // started, but might have finished since then on the compositor thread.
568 EffectNode* node = property_trees->effect_tree.Node(
569 property_trees->effect_id_to_index_map[id()]);
570 if (node->opacity == opacity)
571 return;
572 node->opacity = opacity;
573 node->effect_changed = true;
574 property_trees->changed = true;
575 property_trees->effect_tree.set_needs_update(true);
576 }
577 }
578
579 void LayerImpl::UpdatePropertyTreeForScrollingAndAnimationIfNeeded() { 560 void LayerImpl::UpdatePropertyTreeForScrollingAndAnimationIfNeeded() {
580 if (scrollable()) 561 if (scrollable())
581 UpdatePropertyTreeScrollOffset(); 562 UpdatePropertyTreeScrollOffset();
582 563
583 if (HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM)) { 564 if (HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM)) {
584 UpdatePropertyTreeTransformIsAnimated( 565 UpdatePropertyTreeTransformIsAnimated(
585 HasPotentiallyRunningTransformAnimation()); 566 HasPotentiallyRunningTransformAnimation());
586 } 567 }
587 } 568 }
588 569
(...skipping 10 matching lines...) Expand all
599 if (node->filters == filters) 580 if (node->filters == filters)
600 return; 581 return;
601 node->filters = filters; 582 node->filters = filters;
602 node->effect_changed = true; 583 node->effect_changed = true;
603 property_trees->changed = true; 584 property_trees->changed = true;
604 property_trees->effect_tree.set_needs_update(true); 585 property_trees->effect_tree.set_needs_update(true);
605 SetNeedsPushProperties(); 586 SetNeedsPushProperties();
606 layer_tree_impl()->set_needs_update_draw_properties(); 587 layer_tree_impl()->set_needs_update_draw_properties();
607 } 588 }
608 589
609 void LayerImpl::OnOpacityAnimated(float opacity) {
610 UpdatePropertyTreeOpacity(opacity);
611 layer_tree_impl()->set_needs_update_draw_properties();
612 layer_tree_impl()->AddToOpacityAnimationsMap(id(), opacity);
613 }
614
615 void LayerImpl::OnTransformAnimated(const gfx::Transform& transform) { 590 void LayerImpl::OnTransformAnimated(const gfx::Transform& transform) {
616 UpdatePropertyTreeTransform(transform); 591 UpdatePropertyTreeTransform(transform);
617 was_ever_ready_since_last_transform_animation_ = false; 592 was_ever_ready_since_last_transform_animation_ = false;
618 layer_tree_impl()->AddToTransformAnimationsMap(id(), transform); 593 layer_tree_impl()->AddToTransformAnimationsMap(id(), transform);
619 } 594 }
620 595
621 void LayerImpl::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) { 596 void LayerImpl::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) {
622 // Only layers in the active tree should need to do anything here, since 597 // Only layers in the active tree should need to do anything here, since
623 // layers in the pending tree will find out about these changes as a 598 // layers in the pending tree will find out about these changes as a
624 // result of the shared SyncedProperty. 599 // result of the shared SyncedProperty.
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 .layer_transforms_should_scale_layer_contents) { 1170 .layer_transforms_should_scale_layer_contents) {
1196 return default_scale; 1171 return default_scale;
1197 } 1172 }
1198 1173
1199 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1174 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1200 ScreenSpaceTransform(), default_scale); 1175 ScreenSpaceTransform(), default_scale);
1201 return std::max(transform_scales.x(), transform_scales.y()); 1176 return std::max(transform_scales.x(), transform_scales.y());
1202 } 1177 }
1203 1178
1204 } // namespace cc 1179 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698