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

Side by Side Diff: ui/compositor/float_animation_curve_adapter.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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
« no previous file with comments | « ui/compositor/float_animation_curve_adapter.h ('k') | ui/compositor/layer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/compositor/float_animation_curve_adapter.h" 5 #include "ui/compositor/float_animation_curve_adapter.h"
6 6
7 #include "base/memory/ptr_util.h"
7 #include "cc/base/time_util.h" 8 #include "cc/base/time_util.h"
8 9
9 namespace ui { 10 namespace ui {
10 11
11 FloatAnimationCurveAdapter::FloatAnimationCurveAdapter( 12 FloatAnimationCurveAdapter::FloatAnimationCurveAdapter(
12 gfx::Tween::Type tween_type, 13 gfx::Tween::Type tween_type,
13 float initial_value, 14 float initial_value,
14 float target_value, 15 float target_value,
15 base::TimeDelta duration) 16 base::TimeDelta duration)
16 : tween_type_(tween_type), 17 : tween_type_(tween_type),
17 initial_value_(initial_value), 18 initial_value_(initial_value),
18 target_value_(target_value), 19 target_value_(target_value),
19 duration_(duration) { 20 duration_(duration) {
20 } 21 }
21 22
22 base::TimeDelta FloatAnimationCurveAdapter::Duration() const { 23 base::TimeDelta FloatAnimationCurveAdapter::Duration() const {
23 return duration_; 24 return duration_;
24 } 25 }
25 26
26 scoped_ptr<cc::AnimationCurve> FloatAnimationCurveAdapter::Clone() const { 27 std::unique_ptr<cc::AnimationCurve> FloatAnimationCurveAdapter::Clone() const {
27 return make_scoped_ptr(new FloatAnimationCurveAdapter( 28 return base::WrapUnique(new FloatAnimationCurveAdapter(
28 tween_type_, initial_value_, target_value_, duration_)); 29 tween_type_, initial_value_, target_value_, duration_));
29 } 30 }
30 31
31 float FloatAnimationCurveAdapter::GetValue(base::TimeDelta t) const { 32 float FloatAnimationCurveAdapter::GetValue(base::TimeDelta t) const {
32 if (t >= duration_) 33 if (t >= duration_)
33 return target_value_; 34 return target_value_;
34 if (t <= base::TimeDelta()) 35 if (t <= base::TimeDelta())
35 return initial_value_; 36 return initial_value_;
36 double progress = cc::TimeUtil::Divide(t, duration_); 37 double progress = cc::TimeUtil::Divide(t, duration_);
37 return gfx::Tween::FloatValueBetween( 38 return gfx::Tween::FloatValueBetween(
38 gfx::Tween::CalculateValue(tween_type_, progress), 39 gfx::Tween::CalculateValue(tween_type_, progress),
39 initial_value_, 40 initial_value_,
40 target_value_); 41 target_value_);
41 } 42 }
42 43
43 } // namespace ui 44 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/float_animation_curve_adapter.h ('k') | ui/compositor/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698