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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "third_party/skia/include/utils/SkMatrix44.h" | 11 #include "third_party/skia/include/utils/SkMatrix44.h" |
12 #include "ui/base/ui_export.h" | 12 #include "ui/base/ui_export.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 | 15 |
16 class RectF; | 16 class RectF; |
17 class Point; | 17 class Point; |
18 class Point3F; | 18 class Point3F; |
19 class Vector3dF; | 19 class Vector3dF; |
20 | 20 |
21 // 4x4 transformation matrix. Transform is cheap and explicitly allows | 21 // 4x4 transformation matrix. Transform is cheap and explicitly allows |
22 // copy/assign. | 22 // copy/assign. |
23 class UI_EXPORT Transform { | 23 class UI_EXPORT Transform { |
24 public: | 24 public: |
| 25 |
| 26 enum SkipInitialization { |
| 27 kSkipInitialization |
| 28 }; |
| 29 |
25 Transform() : matrix_(SkMatrix44::kIdentity_Constructor) {} | 30 Transform() : matrix_(SkMatrix44::kIdentity_Constructor) {} |
| 31 |
| 32 // Skips initializing this matrix to avoid overhead, when we know it will be |
| 33 // initialized before use. |
| 34 Transform(SkipInitialization) |
| 35 : matrix_(SkMatrix44::kUninitialized_Constructor) {} |
26 Transform(const Transform& rhs) : matrix_(rhs.matrix_) {} | 36 Transform(const Transform& rhs) : matrix_(rhs.matrix_) {} |
27 // Initialize with the concatenation of lhs * rhs. | 37 // Initialize with the concatenation of lhs * rhs. |
28 Transform(const Transform& lhs, const Transform& rhs) | 38 Transform(const Transform& lhs, const Transform& rhs) |
29 : matrix_(lhs.matrix_, rhs.matrix_) {} | 39 : matrix_(lhs.matrix_, rhs.matrix_) {} |
30 ~Transform() {} | 40 ~Transform() {} |
31 | 41 |
32 bool operator==(const Transform& rhs) const { return matrix_ == rhs.matrix_; } | 42 bool operator==(const Transform& rhs) const { return matrix_ == rhs.matrix_; } |
33 bool operator!=(const Transform& rhs) const { return matrix_ != rhs.matrix_; } | 43 bool operator!=(const Transform& rhs) const { return matrix_ != rhs.matrix_; } |
34 | 44 |
35 // Resets this transform to the identity transform. | 45 // Resets this transform to the identity transform. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 Point3F& point) const; | 183 Point3F& point) const; |
174 | 184 |
175 SkMatrix44 matrix_; | 185 SkMatrix44 matrix_; |
176 | 186 |
177 // copy/assign are allowed. | 187 // copy/assign are allowed. |
178 }; | 188 }; |
179 | 189 |
180 } // namespace gfx | 190 } // namespace gfx |
181 | 191 |
182 #endif // UI_GFX_TRANSFORM_H_ | 192 #endif // UI_GFX_TRANSFORM_H_ |
OLD | NEW |