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

Side by Side Diff: cc/animation/layer_animation_controller.cc

Issue 1076313006: Animation start scale should be considered for the raster scale (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing and Added more tests Created 5 years, 7 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/animation/layer_animation_controller.h" 5 #include "cc/animation/layer_animation_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "cc/animation/animation.h" 10 #include "cc/animation/animation.h"
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 506
507 const TransformAnimationCurve* transform_animation_curve = 507 const TransformAnimationCurve* transform_animation_curve =
508 animations_[i]->curve()->ToTransformAnimationCurve(); 508 animations_[i]->curve()->ToTransformAnimationCurve();
509 if (!transform_animation_curve->PreservesAxisAlignment()) 509 if (!transform_animation_curve->PreservesAxisAlignment())
510 return false; 510 return false;
511 } 511 }
512 512
513 return true; 513 return true;
514 } 514 }
515 515
516 bool LayerAnimationController::AnimationStartScale(float* start_scale) const {
517 *start_scale = 0.f;
518 for (size_t i = 0; i < animations_.size(); ++i) {
519 if (animations_[i]->is_finished() ||
520 animations_[i]->target_property() != Animation::TRANSFORM)
521 continue;
522
523 bool forward_direction = true;
524 switch (animations_[i]->direction()) {
525 case Animation::DIRECTION_NORMAL:
526 case Animation::DIRECTION_ALTERNATE:
527 forward_direction = animations_[i]->playback_rate() >= 0.0;
528 break;
529 case Animation::DIRECTION_REVERSE:
530 case Animation::DIRECTION_ALTERNATE_REVERSE:
531 forward_direction = animations_[i]->playback_rate() < 0.0;
532 break;
533 }
534
535 const TransformAnimationCurve* transform_animation_curve =
536 animations_[i]->curve()->ToTransformAnimationCurve();
537 float animation_start_scale = 0.f;
538 if (!transform_animation_curve->AnimationStartScale(forward_direction,
539 &animation_start_scale))
540 return false;
541 *start_scale = std::max(*start_scale, animation_start_scale);
542 }
543 return true;
544 }
545
516 bool LayerAnimationController::MaximumTargetScale(float* max_scale) const { 546 bool LayerAnimationController::MaximumTargetScale(float* max_scale) const {
517 *max_scale = 0.f; 547 *max_scale = 0.f;
518 for (size_t i = 0; i < animations_.size(); ++i) { 548 for (size_t i = 0; i < animations_.size(); ++i) {
519 if (animations_[i]->is_finished() || 549 if (animations_[i]->is_finished() ||
520 animations_[i]->target_property() != Animation::TRANSFORM) 550 animations_[i]->target_property() != Animation::TRANSFORM)
521 continue; 551 continue;
522 552
523 bool forward_direction = true; 553 bool forward_direction = true;
524 switch (animations_[i]->direction()) { 554 switch (animations_[i]->direction()) {
525 case Animation::DIRECTION_NORMAL: 555 case Animation::DIRECTION_NORMAL:
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 &value_observers_); 1068 &value_observers_);
1039 LayerAnimationValueObserver* obs; 1069 LayerAnimationValueObserver* obs;
1040 while ((obs = it.GetNext()) != nullptr) 1070 while ((obs = it.GetNext()) != nullptr)
1041 if (obs->IsActive()) 1071 if (obs->IsActive())
1042 return true; 1072 return true;
1043 } 1073 }
1044 return false; 1074 return false;
1045 } 1075 }
1046 1076
1047 } // namespace cc 1077 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/layer_animation_controller.h ('k') | cc/animation/layer_animation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698