| 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 "cc/animation/keyframed_animation_curve.h" | 5 #include "cc/animation/keyframed_animation_curve.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 to_return->AddKeyframe(keyframes_[i]->Clone()); | 336 to_return->AddKeyframe(keyframes_[i]->Clone()); |
| 337 | 337 |
| 338 if (timing_function_) | 338 if (timing_function_) |
| 339 to_return->SetTimingFunction(timing_function_->Clone()); | 339 to_return->SetTimingFunction(timing_function_->Clone()); |
| 340 | 340 |
| 341 to_return->set_scaled_duration(scaled_duration()); | 341 to_return->set_scaled_duration(scaled_duration()); |
| 342 | 342 |
| 343 return std::move(to_return); | 343 return std::move(to_return); |
| 344 } | 344 } |
| 345 | 345 |
| 346 gfx::Transform KeyframedTransformAnimationCurve::GetValue( | 346 TransformOperations KeyframedTransformAnimationCurve::GetValue( |
| 347 base::TimeDelta t) const { | 347 base::TimeDelta t) const { |
| 348 if (t <= TimeUtil::Scale(keyframes_.front()->Time(), scaled_duration())) | 348 if (t <= TimeUtil::Scale(keyframes_.front()->Time(), scaled_duration())) |
| 349 return keyframes_.front()->Value().Apply(); | 349 return keyframes_.front()->Value(); |
| 350 | 350 |
| 351 if (t >= TimeUtil::Scale(keyframes_.back()->Time(), scaled_duration())) | 351 if (t >= TimeUtil::Scale(keyframes_.back()->Time(), scaled_duration())) |
| 352 return keyframes_.back()->Value().Apply(); | 352 return keyframes_.back()->Value(); |
| 353 | 353 |
| 354 t = TransformedAnimationTime(keyframes_, timing_function_, scaled_duration(), | 354 t = TransformedAnimationTime(keyframes_, timing_function_, scaled_duration(), |
| 355 t); | 355 t); |
| 356 size_t i = GetActiveKeyframe(keyframes_, scaled_duration(), t); | 356 size_t i = GetActiveKeyframe(keyframes_, scaled_duration(), t); |
| 357 double progress = | 357 double progress = |
| 358 TransformedKeyframeProgress(keyframes_, scaled_duration(), t, i); | 358 TransformedKeyframeProgress(keyframes_, scaled_duration(), t, i); |
| 359 | 359 |
| 360 return keyframes_[i + 1]->Value().Blend(keyframes_[i]->Value(), progress); | 360 return keyframes_[i + 1]->Value().Blend(keyframes_[i]->Value(), progress); |
| 361 } | 361 } |
| 362 | 362 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 bool KeyframedFilterAnimationCurve::HasFilterThatMovesPixels() const { | 489 bool KeyframedFilterAnimationCurve::HasFilterThatMovesPixels() const { |
| 490 for (size_t i = 0; i < keyframes_.size(); ++i) { | 490 for (size_t i = 0; i < keyframes_.size(); ++i) { |
| 491 if (keyframes_[i]->Value().HasFilterThatMovesPixels()) { | 491 if (keyframes_[i]->Value().HasFilterThatMovesPixels()) { |
| 492 return true; | 492 return true; |
| 493 } | 493 } |
| 494 } | 494 } |
| 495 return false; | 495 return false; |
| 496 } | 496 } |
| 497 | 497 |
| 498 } // namespace cc | 498 } // namespace cc |
| OLD | NEW |