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

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

Issue 642983003: cc: Make PictureLayerImpl use a better choice for animated raster scale. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: animationscale: fixes Created 6 years, 2 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 9
9 #include "cc/animation/animation.h" 10 #include "cc/animation/animation.h"
10 #include "cc/animation/animation_delegate.h" 11 #include "cc/animation/animation_delegate.h"
11 #include "cc/animation/animation_registrar.h" 12 #include "cc/animation/animation_registrar.h"
12 #include "cc/animation/keyframed_animation_curve.h" 13 #include "cc/animation/keyframed_animation_curve.h"
13 #include "cc/animation/layer_animation_value_observer.h" 14 #include "cc/animation/layer_animation_value_observer.h"
14 #include "cc/animation/layer_animation_value_provider.h" 15 #include "cc/animation/layer_animation_value_provider.h"
15 #include "cc/animation/scroll_offset_animation_curve.h" 16 #include "cc/animation/scroll_offset_animation_curve.h"
16 #include "cc/base/scoped_ptr_algorithm.h" 17 #include "cc/base/scoped_ptr_algorithm.h"
17 #include "cc/output/filter_operations.h" 18 #include "cc/output/filter_operations.h"
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 488
488 const TransformAnimationCurve* transform_animation_curve = 489 const TransformAnimationCurve* transform_animation_curve =
489 animations_[i]->curve()->ToTransformAnimationCurve(); 490 animations_[i]->curve()->ToTransformAnimationCurve();
490 if (!transform_animation_curve->IsTranslation()) 491 if (!transform_animation_curve->IsTranslation())
491 return false; 492 return false;
492 } 493 }
493 494
494 return true; 495 return true;
495 } 496 }
496 497
497 bool LayerAnimationController::MaximumScale(float* max_scale) const { 498 bool LayerAnimationController::MaximumTargetScale(float* max_scale) const {
498 *max_scale = 0.f; 499 *max_scale = 0.f;
499 for (size_t i = 0; i < animations_.size(); ++i) { 500 for (size_t i = 0; i < animations_.size(); ++i) {
500 if (animations_[i]->is_finished() || 501 if (animations_[i]->is_finished() ||
501 animations_[i]->target_property() != Animation::Transform) 502 animations_[i]->target_property() != Animation::Transform)
502 continue; 503 continue;
503 504
504 const TransformAnimationCurve* transform_animation_curve = 505 const TransformAnimationCurve* transform_animation_curve =
505 animations_[i]->curve()->ToTransformAnimationCurve(); 506 animations_[i]->curve()->ToTransformAnimationCurve();
ajuma 2014/10/10 13:43:07 We also need to account for animations being run i
danakj 2014/10/10 15:14:45 OK I think I have this now, thanks!
506 float animation_scale = 0.f; 507 float animation_scale = 0.f;
507 if (!transform_animation_curve->MaximumScale(&animation_scale)) 508 if (!transform_animation_curve->MaximumTargetScale(&animation_scale))
508 return false; 509 return false;
509 *max_scale = std::max(*max_scale, animation_scale); 510 *max_scale = std::max(*max_scale, animation_scale);
510 } 511 }
511 512
512 return true; 513 return true;
513 } 514 }
514 515
515 void LayerAnimationController::PushNewAnimationsToImplThread( 516 void LayerAnimationController::PushNewAnimationsToImplThread(
516 LayerAnimationController* controller_impl) const { 517 LayerAnimationController* controller_impl) const {
517 // Any new animations owned by the main thread's controller are cloned and 518 // Any new animations owned by the main thread's controller are cloned and
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 value_observers_); 1015 value_observers_);
1015 LayerAnimationValueObserver* obs; 1016 LayerAnimationValueObserver* obs;
1016 while ((obs = it.GetNext()) != nullptr) 1017 while ((obs = it.GetNext()) != nullptr)
1017 if (obs->IsActive()) 1018 if (obs->IsActive())
1018 return true; 1019 return true;
1019 } 1020 }
1020 return false; 1021 return false;
1021 } 1022 }
1022 1023
1023 } // namespace cc 1024 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698