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

Unified Diff: cc/animation/keyframed_animation_curve.cc

Issue 608503005: Revert of cc: Remove use of PassAs() and constructor-casting with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/animation/animation_unittest.cc ('k') | cc/animation/keyframed_animation_curve_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/keyframed_animation_curve.cc
diff --git a/cc/animation/keyframed_animation_curve.cc b/cc/animation/keyframed_animation_curve.cc
index f4e9e2732d2645aff46ba890ec2c1c7eda34cfbc..e98a2e6945dbbf3c8a2f36fcac1ca2ffce79ff06 100644
--- a/cc/animation/keyframed_animation_curve.cc
+++ b/cc/animation/keyframed_animation_curve.cc
@@ -14,19 +14,19 @@
template <class Keyframe>
void InsertKeyframe(scoped_ptr<Keyframe> keyframe,
- ScopedPtrVector<Keyframe>* keyframes) {
+ ScopedPtrVector<Keyframe>& keyframes) {
// Usually, the keyframes will be added in order, so this loop would be
// unnecessary and we should skip it if possible.
- if (!keyframes->empty() && keyframe->Time() < keyframes->back()->Time()) {
- for (size_t i = 0; i < keyframes->size(); ++i) {
- if (keyframe->Time() < keyframes->at(i)->Time()) {
- keyframes->insert(keyframes->begin() + i, keyframe.Pass());
+ if (!keyframes.empty() && keyframe->Time() < keyframes.back()->Time()) {
+ for (size_t i = 0; i < keyframes.size(); ++i) {
+ if (keyframe->Time() < keyframes[i]->Time()) {
+ keyframes.insert(keyframes.begin() + i, keyframe.Pass());
return;
}
}
}
- keyframes->push_back(keyframe.Pass());
+ keyframes.push_back(keyframe.Pass());
}
template <class Keyframes>
@@ -169,7 +169,7 @@
void KeyframedColorAnimationCurve::AddKeyframe(
scoped_ptr<ColorKeyframe> keyframe) {
- InsertKeyframe(keyframe.Pass(), &keyframes_);
+ InsertKeyframe(keyframe.Pass(), keyframes_);
}
double KeyframedColorAnimationCurve::Duration() const {
@@ -177,11 +177,11 @@
}
scoped_ptr<AnimationCurve> KeyframedColorAnimationCurve::Clone() const {
- scoped_ptr<KeyframedColorAnimationCurve> to_return =
- KeyframedColorAnimationCurve::Create();
+ scoped_ptr<KeyframedColorAnimationCurve> to_return(
+ KeyframedColorAnimationCurve::Create());
for (size_t i = 0; i < keyframes_.size(); ++i)
to_return->AddKeyframe(keyframes_[i]->Clone());
- return to_return.Pass();
+ return to_return.PassAs<AnimationCurve>();
}
SkColor KeyframedColorAnimationCurve::GetValue(double t) const {
@@ -216,7 +216,7 @@
void KeyframedFloatAnimationCurve::AddKeyframe(
scoped_ptr<FloatKeyframe> keyframe) {
- InsertKeyframe(keyframe.Pass(), &keyframes_);
+ InsertKeyframe(keyframe.Pass(), keyframes_);
}
double KeyframedFloatAnimationCurve::Duration() const {
@@ -224,11 +224,11 @@
}
scoped_ptr<AnimationCurve> KeyframedFloatAnimationCurve::Clone() const {
- scoped_ptr<KeyframedFloatAnimationCurve> to_return =
- KeyframedFloatAnimationCurve::Create();
+ scoped_ptr<KeyframedFloatAnimationCurve> to_return(
+ KeyframedFloatAnimationCurve::Create());
for (size_t i = 0; i < keyframes_.size(); ++i)
to_return->AddKeyframe(keyframes_[i]->Clone());
- return to_return.Pass();
+ return to_return.PassAs<AnimationCurve>();
}
float KeyframedFloatAnimationCurve::GetValue(double t) const {
@@ -261,7 +261,7 @@
void KeyframedTransformAnimationCurve::AddKeyframe(
scoped_ptr<TransformKeyframe> keyframe) {
- InsertKeyframe(keyframe.Pass(), &keyframes_);
+ InsertKeyframe(keyframe.Pass(), keyframes_);
}
double KeyframedTransformAnimationCurve::Duration() const {
@@ -269,11 +269,11 @@
}
scoped_ptr<AnimationCurve> KeyframedTransformAnimationCurve::Clone() const {
- scoped_ptr<KeyframedTransformAnimationCurve> to_return =
- KeyframedTransformAnimationCurve::Create();
+ scoped_ptr<KeyframedTransformAnimationCurve> to_return(
+ KeyframedTransformAnimationCurve::Create());
for (size_t i = 0; i < keyframes_.size(); ++i)
to_return->AddKeyframe(keyframes_[i]->Clone());
- return to_return.Pass();
+ return to_return.PassAs<AnimationCurve>();
}
// Assumes that (*keyframes).front()->Time() < t < (*keyframes).back()-Time().
@@ -376,7 +376,7 @@
void KeyframedFilterAnimationCurve::AddKeyframe(
scoped_ptr<FilterKeyframe> keyframe) {
- InsertKeyframe(keyframe.Pass(), &keyframes_);
+ InsertKeyframe(keyframe.Pass(), keyframes_);
}
double KeyframedFilterAnimationCurve::Duration() const {
@@ -384,11 +384,11 @@
}
scoped_ptr<AnimationCurve> KeyframedFilterAnimationCurve::Clone() const {
- scoped_ptr<KeyframedFilterAnimationCurve> to_return =
- KeyframedFilterAnimationCurve::Create();
+ scoped_ptr<KeyframedFilterAnimationCurve> to_return(
+ KeyframedFilterAnimationCurve::Create());
for (size_t i = 0; i < keyframes_.size(); ++i)
to_return->AddKeyframe(keyframes_[i]->Clone());
- return to_return.Pass();
+ return to_return.PassAs<AnimationCurve>();
}
FilterOperations KeyframedFilterAnimationCurve::GetValue(double t) const {
« no previous file with comments | « cc/animation/animation_unittest.cc ('k') | cc/animation/keyframed_animation_curve_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698