| OLD | NEW |
| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "cc/animation/keyframed_animation_curve.h" | 7 #include "cc/animation/keyframed_animation_curve.h" |
| 8 #include "cc/base/time_util.h" | 8 #include "cc/base/time_util.h" |
| 9 #include "ui/gfx/animation/tween.h" | 9 #include "ui/gfx/animation/tween.h" |
| 10 #include "ui/gfx/geometry/box_f.h" | 10 #include "ui/gfx/geometry/box_f.h" |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 } | 372 } |
| 373 | 373 |
| 374 bool KeyframedTransformAnimationCurve::IsTranslation() const { | 374 bool KeyframedTransformAnimationCurve::IsTranslation() const { |
| 375 for (size_t i = 0; i < keyframes_.size(); ++i) { | 375 for (size_t i = 0; i < keyframes_.size(); ++i) { |
| 376 if (!keyframes_[i]->Value().IsTranslation() && | 376 if (!keyframes_[i]->Value().IsTranslation() && |
| 377 !keyframes_[i]->Value().IsIdentity()) | 377 !keyframes_[i]->Value().IsIdentity()) |
| 378 return false; | 378 return false; |
| 379 } | 379 } |
| 380 return true; | 380 return true; |
| 381 } | 381 } |
| 382 bool KeyframedTransformAnimationCurve::AnimationStartScale( |
| 383 bool forward_direction, |
| 384 float* start_scale) const { |
| 385 DCHECK_GE(keyframes_.size(), 2ul); |
| 386 *start_scale = 0.f; |
| 387 size_t start_location = 0; |
| 388 if (!forward_direction) { |
| 389 start_location = keyframes_.size() - 1; |
| 390 } |
| 382 | 391 |
| 392 gfx::Vector3dF initial_target_scale; |
| 393 if (!keyframes_[start_location]->Value().ScaleComponent( |
| 394 &initial_target_scale)) |
| 395 return false; |
| 396 float start_scale_for_segment = |
| 397 fmax(std::abs(initial_target_scale.x()), |
| 398 fmax(std::abs(initial_target_scale.y()), |
| 399 std::abs(initial_target_scale.z()))); |
| 400 *start_scale = start_scale_for_segment; |
| 401 return true; |
| 402 } |
| 383 bool KeyframedTransformAnimationCurve::MaximumTargetScale( | 403 bool KeyframedTransformAnimationCurve::MaximumTargetScale( |
| 384 bool forward_direction, | 404 bool forward_direction, |
| 385 float* max_scale) const { | 405 float* max_scale) const { |
| 386 DCHECK_GE(keyframes_.size(), 2ul); | 406 DCHECK_GE(keyframes_.size(), 2ul); |
| 387 *max_scale = 0.f; | 407 *max_scale = 0.f; |
| 388 | 408 |
| 389 // If |forward_direction| is true, then skip the first frame, otherwise | 409 // If |forward_direction| is true, then skip the first frame, otherwise |
| 390 // skip the last frame, since that is the original position in the animation. | 410 // skip the last frame, since that is the original position in the animation. |
| 391 size_t start = 1; | 411 size_t start = 1; |
| 392 size_t end = keyframes_.size(); | 412 size_t end = keyframes_.size(); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 bool KeyframedFilterAnimationCurve::HasFilterThatMovesPixels() const { | 476 bool KeyframedFilterAnimationCurve::HasFilterThatMovesPixels() const { |
| 457 for (size_t i = 0; i < keyframes_.size(); ++i) { | 477 for (size_t i = 0; i < keyframes_.size(); ++i) { |
| 458 if (keyframes_[i]->Value().HasFilterThatMovesPixels()) { | 478 if (keyframes_[i]->Value().HasFilterThatMovesPixels()) { |
| 459 return true; | 479 return true; |
| 460 } | 480 } |
| 461 } | 481 } |
| 462 return false; | 482 return false; |
| 463 } | 483 } |
| 464 | 484 |
| 465 } // namespace cc | 485 } // namespace cc |
| OLD | NEW |