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

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: Fix compile error 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
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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 // corresponding Layer at the time of the last commit. For example, if 533 // corresponding Layer at the time of the last commit. For example, if
534 // |is_animated| is false, this might mean a transform animation just ticked 534 // |is_animated| is false, this might mean a transform animation just ticked
535 // past its finish point (so the LayerImpl still owns a TransformNode) or it 535 // past its finish point (so the LayerImpl still owns a TransformNode) or it
536 // might mean that a transform animation was removed during commit or 536 // might mean that a transform animation was removed during commit or
537 // activation (and, in that case, the LayerImpl will no longer own a 537 // activation (and, in that case, the LayerImpl will no longer own a
538 // TransformNode, unless it has non-animation-related reasons for owning a 538 // TransformNode, unless it has non-animation-related reasons for owning a
539 // node). 539 // node).
540 if (node->data.has_potential_animation != is_animated) { 540 if (node->data.has_potential_animation != is_animated) {
541 node->data.has_potential_animation = is_animated; 541 node->data.has_potential_animation = is_animated;
542 if (is_animated) { 542 if (is_animated) {
543 float maximum_target_scale = 0.f;
544 node->data.local_maximum_animation_target_scale =
545 MaximumTargetScale(&maximum_target_scale) ? maximum_target_scale
546 : 0.f;
547
548 float animation_start_scale = 0.f;
549 node->data.local_starting_animation_scale =
550 AnimationStartScale(&animation_start_scale) ? animation_start_scale
551 : 0.f;
552
553 node->data.has_only_translation_animations = 543 node->data.has_only_translation_animations =
554 HasOnlyTranslationTransforms(); 544 HasOnlyTranslationTransforms();
555 } else { 545 } else {
556 node->data.local_maximum_animation_target_scale = 0.f;
557 node->data.local_starting_animation_scale = 0.f;
558 node->data.has_only_translation_animations = true; 546 node->data.has_only_translation_animations = true;
559 } 547 }
560 548
561 property_trees->transform_tree.set_needs_update(true); 549 property_trees->transform_tree.set_needs_update(true);
562 layer_tree_impl()->set_needs_update_draw_properties(); 550 layer_tree_impl()->set_needs_update_draw_properties();
563 } 551 }
564 } 552 }
565 } 553 }
566 554
567 void LayerImpl::UpdatePropertyTreeOpacity(float opacity) { 555 void LayerImpl::UpdatePropertyTreeOpacity(float opacity) {
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 .layer_transforms_should_scale_layer_contents) { 1192 .layer_transforms_should_scale_layer_contents) {
1205 return default_scale; 1193 return default_scale;
1206 } 1194 }
1207 1195
1208 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1196 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1209 ScreenSpaceTransform(), default_scale); 1197 ScreenSpaceTransform(), default_scale);
1210 return std::max(transform_scales.x(), transform_scales.y()); 1198 return std::max(transform_scales.x(), transform_scales.y());
1211 } 1199 }
1212 1200
1213 } // namespace cc 1201 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698