| OLD | NEW |
| 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 #ifndef UI_GFX_INTERPOLATED_TRANSFORM_H_ | 5 #ifndef UI_GFX_INTERPOLATED_TRANSFORM_H_ |
| 6 #define UI_GFX_INTERPOLATED_TRANSFORM_H_ | 6 #define UI_GFX_INTERPOLATED_TRANSFORM_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 class GFX_EXPORT InterpolatedRotation : public InterpolatedTransform { | 87 class GFX_EXPORT InterpolatedRotation : public InterpolatedTransform { |
| 88 public: | 88 public: |
| 89 InterpolatedRotation(float start_degrees, float end_degrees); | 89 InterpolatedRotation(float start_degrees, float end_degrees); |
| 90 InterpolatedRotation(float start_degrees, | 90 InterpolatedRotation(float start_degrees, |
| 91 float end_degrees, | 91 float end_degrees, |
| 92 float start_time, | 92 float start_time, |
| 93 float end_time); | 93 float end_time); |
| 94 virtual ~InterpolatedRotation(); | 94 virtual ~InterpolatedRotation(); |
| 95 | 95 |
| 96 protected: | 96 protected: |
| 97 virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; | 97 virtual gfx::Transform InterpolateButDoNotCompose(float t) const override; |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 const float start_degrees_; | 100 const float start_degrees_; |
| 101 const float end_degrees_; | 101 const float end_degrees_; |
| 102 | 102 |
| 103 DISALLOW_COPY_AND_ASSIGN(InterpolatedRotation); | 103 DISALLOW_COPY_AND_ASSIGN(InterpolatedRotation); |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 /////////////////////////////////////////////////////////////////////////////// | 106 /////////////////////////////////////////////////////////////////////////////// |
| 107 // class InterpolatedAxisAngleRotation | 107 // class InterpolatedAxisAngleRotation |
| 108 // | 108 // |
| 109 // Represents an animated rotation. | 109 // Represents an animated rotation. |
| 110 // | 110 // |
| 111 /////////////////////////////////////////////////////////////////////////////// | 111 /////////////////////////////////////////////////////////////////////////////// |
| 112 class GFX_EXPORT InterpolatedAxisAngleRotation : public InterpolatedTransform { | 112 class GFX_EXPORT InterpolatedAxisAngleRotation : public InterpolatedTransform { |
| 113 public: | 113 public: |
| 114 InterpolatedAxisAngleRotation(const gfx::Vector3dF& axis, | 114 InterpolatedAxisAngleRotation(const gfx::Vector3dF& axis, |
| 115 float start_degrees, | 115 float start_degrees, |
| 116 float end_degrees); | 116 float end_degrees); |
| 117 InterpolatedAxisAngleRotation(const gfx::Vector3dF& axis, | 117 InterpolatedAxisAngleRotation(const gfx::Vector3dF& axis, |
| 118 float start_degrees, | 118 float start_degrees, |
| 119 float end_degrees, | 119 float end_degrees, |
| 120 float start_time, | 120 float start_time, |
| 121 float end_time); | 121 float end_time); |
| 122 virtual ~InterpolatedAxisAngleRotation(); | 122 virtual ~InterpolatedAxisAngleRotation(); |
| 123 | 123 |
| 124 protected: | 124 protected: |
| 125 virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; | 125 virtual gfx::Transform InterpolateButDoNotCompose(float t) const override; |
| 126 | 126 |
| 127 private: | 127 private: |
| 128 gfx::Vector3dF axis_; | 128 gfx::Vector3dF axis_; |
| 129 const float start_degrees_; | 129 const float start_degrees_; |
| 130 const float end_degrees_; | 130 const float end_degrees_; |
| 131 | 131 |
| 132 DISALLOW_COPY_AND_ASSIGN(InterpolatedAxisAngleRotation); | 132 DISALLOW_COPY_AND_ASSIGN(InterpolatedAxisAngleRotation); |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 /////////////////////////////////////////////////////////////////////////////// | 135 /////////////////////////////////////////////////////////////////////////////// |
| 136 // class InterpolatedScale | 136 // class InterpolatedScale |
| 137 // | 137 // |
| 138 // Represents an animated scale. | 138 // Represents an animated scale. |
| 139 // | 139 // |
| 140 /////////////////////////////////////////////////////////////////////////////// | 140 /////////////////////////////////////////////////////////////////////////////// |
| 141 class GFX_EXPORT InterpolatedScale : public InterpolatedTransform { | 141 class GFX_EXPORT InterpolatedScale : public InterpolatedTransform { |
| 142 public: | 142 public: |
| 143 InterpolatedScale(float start_scale, float end_scale); | 143 InterpolatedScale(float start_scale, float end_scale); |
| 144 InterpolatedScale(float start_scale, float end_scale, | 144 InterpolatedScale(float start_scale, float end_scale, |
| 145 float start_time, float end_time); | 145 float start_time, float end_time); |
| 146 InterpolatedScale(const gfx::Point3F& start_scale, | 146 InterpolatedScale(const gfx::Point3F& start_scale, |
| 147 const gfx::Point3F& end_scale); | 147 const gfx::Point3F& end_scale); |
| 148 InterpolatedScale(const gfx::Point3F& start_scale, | 148 InterpolatedScale(const gfx::Point3F& start_scale, |
| 149 const gfx::Point3F& end_scale, | 149 const gfx::Point3F& end_scale, |
| 150 float start_time, | 150 float start_time, |
| 151 float end_time); | 151 float end_time); |
| 152 virtual ~InterpolatedScale(); | 152 virtual ~InterpolatedScale(); |
| 153 | 153 |
| 154 protected: | 154 protected: |
| 155 virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; | 155 virtual gfx::Transform InterpolateButDoNotCompose(float t) const override; |
| 156 | 156 |
| 157 private: | 157 private: |
| 158 const gfx::Point3F start_scale_; | 158 const gfx::Point3F start_scale_; |
| 159 const gfx::Point3F end_scale_; | 159 const gfx::Point3F end_scale_; |
| 160 | 160 |
| 161 DISALLOW_COPY_AND_ASSIGN(InterpolatedScale); | 161 DISALLOW_COPY_AND_ASSIGN(InterpolatedScale); |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 class GFX_EXPORT InterpolatedTranslation : public InterpolatedTransform { | 164 class GFX_EXPORT InterpolatedTranslation : public InterpolatedTransform { |
| 165 public: | 165 public: |
| 166 InterpolatedTranslation(const gfx::Point& start_pos, | 166 InterpolatedTranslation(const gfx::Point& start_pos, |
| 167 const gfx::Point& end_pos); | 167 const gfx::Point& end_pos); |
| 168 InterpolatedTranslation(const gfx::Point& start_pos, | 168 InterpolatedTranslation(const gfx::Point& start_pos, |
| 169 const gfx::Point& end_pos, | 169 const gfx::Point& end_pos, |
| 170 float start_time, | 170 float start_time, |
| 171 float end_time); | 171 float end_time); |
| 172 virtual ~InterpolatedTranslation(); | 172 virtual ~InterpolatedTranslation(); |
| 173 | 173 |
| 174 protected: | 174 protected: |
| 175 virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; | 175 virtual gfx::Transform InterpolateButDoNotCompose(float t) const override; |
| 176 | 176 |
| 177 private: | 177 private: |
| 178 const gfx::Point start_pos_; | 178 const gfx::Point start_pos_; |
| 179 const gfx::Point end_pos_; | 179 const gfx::Point end_pos_; |
| 180 | 180 |
| 181 DISALLOW_COPY_AND_ASSIGN(InterpolatedTranslation); | 181 DISALLOW_COPY_AND_ASSIGN(InterpolatedTranslation); |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 /////////////////////////////////////////////////////////////////////////////// | 184 /////////////////////////////////////////////////////////////////////////////// |
| 185 // class InterpolatedConstantTransform | 185 // class InterpolatedConstantTransform |
| 186 // | 186 // |
| 187 // Represents a transform that is constant over time. This is only useful when | 187 // Represents a transform that is constant over time. This is only useful when |
| 188 // composed with other interpolated transforms. | 188 // composed with other interpolated transforms. |
| 189 // | 189 // |
| 190 // See InterpolatedTransformAboutPivot for an example of its usage. | 190 // See InterpolatedTransformAboutPivot for an example of its usage. |
| 191 // | 191 // |
| 192 /////////////////////////////////////////////////////////////////////////////// | 192 /////////////////////////////////////////////////////////////////////////////// |
| 193 class GFX_EXPORT InterpolatedConstantTransform : public InterpolatedTransform { | 193 class GFX_EXPORT InterpolatedConstantTransform : public InterpolatedTransform { |
| 194 public: | 194 public: |
| 195 explicit InterpolatedConstantTransform(const gfx::Transform& transform); | 195 explicit InterpolatedConstantTransform(const gfx::Transform& transform); |
| 196 virtual ~InterpolatedConstantTransform(); | 196 virtual ~InterpolatedConstantTransform(); |
| 197 | 197 |
| 198 protected: | 198 protected: |
| 199 virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; | 199 virtual gfx::Transform InterpolateButDoNotCompose(float t) const override; |
| 200 | 200 |
| 201 private: | 201 private: |
| 202 const gfx::Transform transform_; | 202 const gfx::Transform transform_; |
| 203 | 203 |
| 204 DISALLOW_COPY_AND_ASSIGN(InterpolatedConstantTransform); | 204 DISALLOW_COPY_AND_ASSIGN(InterpolatedConstantTransform); |
| 205 }; | 205 }; |
| 206 | 206 |
| 207 /////////////////////////////////////////////////////////////////////////////// | 207 /////////////////////////////////////////////////////////////////////////////// |
| 208 // class InterpolatedTransformAboutPivot | 208 // class InterpolatedTransformAboutPivot |
| 209 // | 209 // |
| (...skipping 10 matching lines...) Expand all Loading... |
| 220 InterpolatedTransform* transform); | 220 InterpolatedTransform* transform); |
| 221 | 221 |
| 222 // Takes ownership of the passed transform. | 222 // Takes ownership of the passed transform. |
| 223 InterpolatedTransformAboutPivot(const gfx::Point& pivot, | 223 InterpolatedTransformAboutPivot(const gfx::Point& pivot, |
| 224 InterpolatedTransform* transform, | 224 InterpolatedTransform* transform, |
| 225 float start_time, | 225 float start_time, |
| 226 float end_time); | 226 float end_time); |
| 227 virtual ~InterpolatedTransformAboutPivot(); | 227 virtual ~InterpolatedTransformAboutPivot(); |
| 228 | 228 |
| 229 protected: | 229 protected: |
| 230 virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; | 230 virtual gfx::Transform InterpolateButDoNotCompose(float t) const override; |
| 231 | 231 |
| 232 private: | 232 private: |
| 233 void Init(const gfx::Point& pivot, InterpolatedTransform* transform); | 233 void Init(const gfx::Point& pivot, InterpolatedTransform* transform); |
| 234 | 234 |
| 235 scoped_ptr<InterpolatedTransform> transform_; | 235 scoped_ptr<InterpolatedTransform> transform_; |
| 236 | 236 |
| 237 DISALLOW_COPY_AND_ASSIGN(InterpolatedTransformAboutPivot); | 237 DISALLOW_COPY_AND_ASSIGN(InterpolatedTransformAboutPivot); |
| 238 }; | 238 }; |
| 239 | 239 |
| 240 class GFX_EXPORT InterpolatedMatrixTransform : public InterpolatedTransform { | 240 class GFX_EXPORT InterpolatedMatrixTransform : public InterpolatedTransform { |
| 241 public: | 241 public: |
| 242 InterpolatedMatrixTransform(const gfx::Transform& start_transform, | 242 InterpolatedMatrixTransform(const gfx::Transform& start_transform, |
| 243 const gfx::Transform& end_transform); | 243 const gfx::Transform& end_transform); |
| 244 | 244 |
| 245 InterpolatedMatrixTransform(const gfx::Transform& start_transform, | 245 InterpolatedMatrixTransform(const gfx::Transform& start_transform, |
| 246 const gfx::Transform& end_transform, | 246 const gfx::Transform& end_transform, |
| 247 float start_time, | 247 float start_time, |
| 248 float end_time); | 248 float end_time); |
| 249 | 249 |
| 250 virtual ~InterpolatedMatrixTransform(); | 250 virtual ~InterpolatedMatrixTransform(); |
| 251 | 251 |
| 252 protected: | 252 protected: |
| 253 virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; | 253 virtual gfx::Transform InterpolateButDoNotCompose(float t) const override; |
| 254 | 254 |
| 255 private: | 255 private: |
| 256 void Init(const gfx::Transform& start_transform, | 256 void Init(const gfx::Transform& start_transform, |
| 257 const gfx::Transform& end_transform); | 257 const gfx::Transform& end_transform); |
| 258 | 258 |
| 259 gfx::DecomposedTransform start_decomp_; | 259 gfx::DecomposedTransform start_decomp_; |
| 260 gfx::DecomposedTransform end_decomp_; | 260 gfx::DecomposedTransform end_decomp_; |
| 261 }; | 261 }; |
| 262 | 262 |
| 263 } // namespace ui | 263 } // namespace ui |
| 264 | 264 |
| 265 #endif // UI_GFX_INTERPOLATED_TRANSFORM_H_ | 265 #endif // UI_GFX_INTERPOLATED_TRANSFORM_H_ |
| OLD | NEW |