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_TRANSFORM_H_ | 5 #ifndef UI_GFX_TRANSFORM_H_ |
6 #define UI_GFX_TRANSFORM_H_ | 6 #define UI_GFX_TRANSFORM_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // sets |this| to the reconstituted result. Returns false if either matrix | 231 // sets |this| to the reconstituted result. Returns false if either matrix |
232 // can't be decomposed. Uses routines described in this spec: | 232 // can't be decomposed. Uses routines described in this spec: |
233 // http://www.w3.org/TR/css3-3d-transforms/. | 233 // http://www.w3.org/TR/css3-3d-transforms/. |
234 // | 234 // |
235 // Note: this call is expensive since we need to decompose the transform. If | 235 // Note: this call is expensive since we need to decompose the transform. If |
236 // you're going to be calling this rapidly (e.g., in an animation) you should | 236 // you're going to be calling this rapidly (e.g., in an animation) you should |
237 // decompose once using gfx::DecomposeTransforms and reuse your | 237 // decompose once using gfx::DecomposeTransforms and reuse your |
238 // DecomposedTransform. | 238 // DecomposedTransform. |
239 bool Blend(const Transform& from, double progress); | 239 bool Blend(const Transform& from, double progress); |
240 | 240 |
| 241 void RoundTranslationComponents(); |
| 242 |
241 // Returns |this| * |other|. | 243 // Returns |this| * |other|. |
242 Transform operator*(const Transform& other) const { | 244 Transform operator*(const Transform& other) const { |
243 return Transform(*this, other); | 245 return Transform(*this, other); |
244 } | 246 } |
245 | 247 |
246 // Sets |this| = |this| * |other| | 248 // Sets |this| = |this| * |other| |
247 Transform& operator*=(const Transform& other) { | 249 Transform& operator*=(const Transform& other) { |
248 PreconcatTransform(other); | 250 PreconcatTransform(other); |
249 return *this; | 251 return *this; |
250 } | 252 } |
(...skipping 17 matching lines...) Expand all Loading... |
268 }; | 270 }; |
269 | 271 |
270 // This is declared here for use in gtest-based unit tests but is defined in | 272 // This is declared here for use in gtest-based unit tests but is defined in |
271 // the gfx_test_support target. Depend on that to use this in your unit test. | 273 // the gfx_test_support target. Depend on that to use this in your unit test. |
272 // This should not be used in production code - call ToString() instead. | 274 // This should not be used in production code - call ToString() instead. |
273 void PrintTo(const Transform& transform, ::std::ostream* os); | 275 void PrintTo(const Transform& transform, ::std::ostream* os); |
274 | 276 |
275 } // namespace gfx | 277 } // namespace gfx |
276 | 278 |
277 #endif // UI_GFX_TRANSFORM_H_ | 279 #endif // UI_GFX_TRANSFORM_H_ |
OLD | NEW |