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

Side by Side Diff: ui/compositor/transform_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
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/transform_animation_curve_adapter.h" 5 #include "ui/compositor/transform_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 TransformAnimationCurveAdapter::TransformAnimationCurveAdapter( 12 TransformAnimationCurveAdapter::TransformAnimationCurveAdapter(
12 gfx::Tween::Type tween_type, 13 gfx::Tween::Type tween_type,
13 gfx::Transform initial_value, 14 gfx::Transform initial_value,
14 gfx::Transform target_value, 15 gfx::Transform 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 gfx::DecomposeTransform(&decomposed_initial_value_, initial_value_); 21 gfx::DecomposeTransform(&decomposed_initial_value_, initial_value_);
21 gfx::DecomposeTransform(&decomposed_target_value_, target_value_); 22 gfx::DecomposeTransform(&decomposed_target_value_, target_value_);
22 } 23 }
23 24
24 TransformAnimationCurveAdapter::TransformAnimationCurveAdapter( 25 TransformAnimationCurveAdapter::TransformAnimationCurveAdapter(
25 const TransformAnimationCurveAdapter& other) = default; 26 const TransformAnimationCurveAdapter& other) = default;
26 27
27 TransformAnimationCurveAdapter::~TransformAnimationCurveAdapter() { 28 TransformAnimationCurveAdapter::~TransformAnimationCurveAdapter() {
28 } 29 }
29 30
30 base::TimeDelta TransformAnimationCurveAdapter::Duration() const { 31 base::TimeDelta TransformAnimationCurveAdapter::Duration() const {
31 return duration_; 32 return duration_;
32 } 33 }
33 34
34 scoped_ptr<cc::AnimationCurve> TransformAnimationCurveAdapter::Clone() const { 35 std::unique_ptr<cc::AnimationCurve> TransformAnimationCurveAdapter::Clone()
35 return make_scoped_ptr(new TransformAnimationCurveAdapter( 36 const {
37 return base::WrapUnique(new TransformAnimationCurveAdapter(
36 tween_type_, initial_value_, target_value_, duration_)); 38 tween_type_, initial_value_, target_value_, duration_));
37 } 39 }
38 40
39 gfx::Transform TransformAnimationCurveAdapter::GetValue( 41 gfx::Transform TransformAnimationCurveAdapter::GetValue(
40 base::TimeDelta t) const { 42 base::TimeDelta t) const {
41 if (t >= duration_) 43 if (t >= duration_)
42 return target_value_; 44 return target_value_;
43 if (t <= base::TimeDelta()) 45 if (t <= base::TimeDelta())
44 return initial_value_; 46 return initial_value_;
45 double progress = cc::TimeUtil::Divide(t, duration_); 47 double progress = cc::TimeUtil::Divide(t, duration_);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 base_curve_.GetValue(base::TimeDelta()) * initial_value_; 103 base_curve_.GetValue(base::TimeDelta()) * initial_value_;
102 } 104 }
103 105
104 InverseTransformCurveAdapter::~InverseTransformCurveAdapter() { 106 InverseTransformCurveAdapter::~InverseTransformCurveAdapter() {
105 } 107 }
106 108
107 base::TimeDelta InverseTransformCurveAdapter::Duration() const { 109 base::TimeDelta InverseTransformCurveAdapter::Duration() const {
108 return duration_; 110 return duration_;
109 } 111 }
110 112
111 scoped_ptr<cc::AnimationCurve> InverseTransformCurveAdapter::Clone() const { 113 std::unique_ptr<cc::AnimationCurve> InverseTransformCurveAdapter::Clone()
112 return make_scoped_ptr( 114 const {
115 return base::WrapUnique(
113 new InverseTransformCurveAdapter(base_curve_, initial_value_, duration_)); 116 new InverseTransformCurveAdapter(base_curve_, initial_value_, duration_));
114 } 117 }
115 118
116 gfx::Transform InverseTransformCurveAdapter::GetValue(base::TimeDelta t) const { 119 gfx::Transform InverseTransformCurveAdapter::GetValue(base::TimeDelta t) const {
117 if (t <= base::TimeDelta()) 120 if (t <= base::TimeDelta())
118 return initial_value_; 121 return initial_value_;
119 122
120 gfx::Transform base_transform = base_curve_.GetValue(t); 123 gfx::Transform base_transform = base_curve_.GetValue(t);
121 // Invert base 124 // Invert base
122 gfx::Transform to_return(gfx::Transform::kSkipInitialization); 125 gfx::Transform to_return(gfx::Transform::kSkipInitialization);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 float* start_scale) const { 160 float* start_scale) const {
158 return false; 161 return false;
159 } 162 }
160 163
161 bool InverseTransformCurveAdapter::MaximumTargetScale(bool forward_direction, 164 bool InverseTransformCurveAdapter::MaximumTargetScale(bool forward_direction,
162 float* max_scale) const { 165 float* max_scale) const {
163 return false; 166 return false;
164 } 167 }
165 168
166 } // namespace ui 169 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/transform_animation_curve_adapter.h ('k') | ui/display/chromeos/apply_content_protection_task_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698