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

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

Issue 2105673003: cc: Compute animation scale on demand (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit changes 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.cc ('k') | cc/layers/picture_layer_impl.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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 // corresponding Layer at the time of the last commit. For example, if 532 // corresponding Layer at the time of the last commit. For example, if
533 // |is_animated| is false, this might mean a transform animation just ticked 533 // |is_animated| is false, this might mean a transform animation just ticked
534 // past its finish point (so the LayerImpl still owns a TransformNode) or it 534 // past its finish point (so the LayerImpl still owns a TransformNode) or it
535 // might mean that a transform animation was removed during commit or 535 // might mean that a transform animation was removed during commit or
536 // activation (and, in that case, the LayerImpl will no longer own a 536 // activation (and, in that case, the LayerImpl will no longer own a
537 // TransformNode, unless it has non-animation-related reasons for owning a 537 // TransformNode, unless it has non-animation-related reasons for owning a
538 // node). 538 // node).
539 if (node->data.has_potential_animation != is_animated) { 539 if (node->data.has_potential_animation != is_animated) {
540 node->data.has_potential_animation = is_animated; 540 node->data.has_potential_animation = is_animated;
541 if (is_animated) { 541 if (is_animated) {
542 float maximum_target_scale = 0.f;
543 node->data.local_maximum_animation_target_scale =
544 MaximumTargetScale(&maximum_target_scale) ? maximum_target_scale
545 : 0.f;
546
547 float animation_start_scale = 0.f;
548 node->data.local_starting_animation_scale =
549 AnimationStartScale(&animation_start_scale) ? animation_start_scale
550 : 0.f;
551
552 node->data.has_only_translation_animations = 542 node->data.has_only_translation_animations =
553 HasOnlyTranslationTransforms(); 543 HasOnlyTranslationTransforms();
554 } else { 544 } else {
555 node->data.local_maximum_animation_target_scale = 0.f;
556 node->data.local_starting_animation_scale = 0.f;
557 node->data.has_only_translation_animations = true; 545 node->data.has_only_translation_animations = true;
558 } 546 }
559 547
560 property_trees->transform_tree.set_needs_update(true); 548 property_trees->transform_tree.set_needs_update(true);
561 layer_tree_impl()->set_needs_update_draw_properties(); 549 layer_tree_impl()->set_needs_update_draw_properties();
562 } 550 }
563 } 551 }
564 } 552 }
565 553
566 void LayerImpl::UpdatePropertyTreeOpacity(float opacity) { 554 void LayerImpl::UpdatePropertyTreeOpacity(float opacity) {
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 .layer_transforms_should_scale_layer_contents) { 1195 .layer_transforms_should_scale_layer_contents) {
1208 return default_scale; 1196 return default_scale;
1209 } 1197 }
1210 1198
1211 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1199 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1212 ScreenSpaceTransform(), default_scale); 1200 ScreenSpaceTransform(), default_scale);
1213 return std::max(transform_scales.x(), transform_scales.y()); 1201 return std::max(transform_scales.x(), transform_scales.y());
1214 } 1202 }
1215 1203
1216 } // namespace cc 1204 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/layers/picture_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698