| 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 "third_party/skia/include/utils/SkMatrix44.h" | 8 #include "third_party/skia/include/utils/SkMatrix44.h" |
| 9 #include "ui/base/ui_export.h" | 9 #include "ui/base/ui_export.h" |
| 10 | 10 |
| 11 namespace gfx { | 11 namespace gfx { |
| 12 | 12 |
| 13 class Rect; | 13 class RectF; |
| 14 class Point; | 14 class Point; |
| 15 class Point3F; | 15 class Point3F; |
| 16 | 16 |
| 17 // 4x4 transformation matrix. Transform is cheap and explicitly allows | 17 // 4x4 transformation matrix. Transform is cheap and explicitly allows |
| 18 // copy/assign. | 18 // copy/assign. |
| 19 class UI_EXPORT Transform { | 19 class UI_EXPORT Transform { |
| 20 public: | 20 public: |
| 21 Transform(); | 21 Transform(); |
| 22 ~Transform(); | 22 ~Transform(); |
| 23 | 23 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // transformation can be inverted. | 95 // transformation can be inverted. |
| 96 bool TransformPointReverse(Point3F& point) const; | 96 bool TransformPointReverse(Point3F& point) const; |
| 97 | 97 |
| 98 // Applies the reverse transformation on the point. Returns true if the | 98 // Applies the reverse transformation on the point. Returns true if the |
| 99 // transformation can be inverted. Rounds the result to the nearest point. | 99 // transformation can be inverted. Rounds the result to the nearest point. |
| 100 bool TransformPointReverse(Point& point) const; | 100 bool TransformPointReverse(Point& point) const; |
| 101 | 101 |
| 102 // Applies transformation on the rectangle. Returns true if the transformed | 102 // Applies transformation on the rectangle. Returns true if the transformed |
| 103 // rectangle was axis aligned. If it returns false, rect will be the | 103 // rectangle was axis aligned. If it returns false, rect will be the |
| 104 // smallest axis aligned bounding box containing the transformed rect. | 104 // smallest axis aligned bounding box containing the transformed rect. |
| 105 void TransformRect(Rect* rect) const; | 105 void TransformRect(RectF* rect) const; |
| 106 | 106 |
| 107 // Applies the reverse transformation on the rectangle. Returns true if | 107 // Applies the reverse transformation on the rectangle. Returns true if |
| 108 // the transformed rectangle was axis aligned. If it returns false, | 108 // the transformed rectangle was axis aligned. If it returns false, |
| 109 // rect will be the smallest axis aligned bounding box containing the | 109 // rect will be the smallest axis aligned bounding box containing the |
| 110 // transformed rect. | 110 // transformed rect. |
| 111 bool TransformRectReverse(Rect* rect) const; | 111 bool TransformRectReverse(RectF* rect) const; |
| 112 | 112 |
| 113 // Returns the underlying matrix. | 113 // Returns the underlying matrix. |
| 114 const SkMatrix44& matrix() const { return matrix_; } | 114 const SkMatrix44& matrix() const { return matrix_; } |
| 115 SkMatrix44& matrix() { return matrix_; } | 115 SkMatrix44& matrix() { return matrix_; } |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 void TransformPointInternal(const SkMatrix44& xform, | 118 void TransformPointInternal(const SkMatrix44& xform, |
| 119 Point& point) const; | 119 Point& point) const; |
| 120 | 120 |
| 121 void TransformPointInternal(const SkMatrix44& xform, | 121 void TransformPointInternal(const SkMatrix44& xform, |
| 122 Point3F& point) const; | 122 Point3F& point) const; |
| 123 | 123 |
| 124 SkMatrix44 matrix_; | 124 SkMatrix44 matrix_; |
| 125 | 125 |
| 126 // copy/assign are allowed. | 126 // copy/assign are allowed. |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 } // namespace gfx | 129 } // namespace gfx |
| 130 | 130 |
| 131 #endif // UI_GFX_TRANSFORM_H_ | 131 #endif // UI_GFX_TRANSFORM_H_ |
| OLD | NEW |