Chromium Code Reviews| Index: ui/gfx/transform.h |
| diff --git a/ui/gfx/transform.h b/ui/gfx/transform.h |
| index 3fdfc3235a36c79eab4508d7481e9c05e8a83278..983a1ae639d46cd88dff158eba03eb24406a44bd 100644 |
| --- a/ui/gfx/transform.h |
| +++ b/ui/gfx/transform.h |
| @@ -8,7 +8,7 @@ |
| #include "base/basictypes.h" |
| #include "base/compiler_specific.h" |
| -#include "third_party/skia/include/core/SkMatrix.h" |
| +#include "third_party/skia/experimental/SkMatrix44.h" |
| namespace gfx { |
| class Point; |
| @@ -17,9 +17,8 @@ class Rect; |
| namespace ui { |
| -// 3x3 transformation matrix. Transform is cheap and explicitly allows |
| +// 4x4 transformation matrix. Transform is cheap and explicitly allows |
| // copy/assign. |
| -// TODO: make this a 4x4. |
| class Transform { |
| public: |
| Transform(); |
| @@ -57,24 +56,22 @@ class Transform { |
| void ConcatTranslate(float x, float y); |
| // Applies a transformation on the current transformation |
| - // (i.e. 'this = this * transform;'). Returns true if the result can be |
| - // represented. |
| - bool PreconcatTransform(const Transform& transform); |
| + // (i.e. 'this = this * transform;'). |
| + void PreconcatTransform(const Transform& transform); |
| // Applies a transformation on the current transformation |
| - // (i.e. 'this = transform * this;'). Returns true if the result can be |
| - // represented. |
| - bool ConcatTransform(const Transform& transform); |
| + // (i.e. 'this = transform * this;'). |
| + void ConcatTransform(const Transform& transform); |
| // Does the transformation change anything? |
| bool HasChange() const; |
| // Applies the transformation on the point. Returns true if the point is |
| // transformed successfully. |
| - bool TransformPoint(gfx::Point* point); |
| + void TransformPoint(gfx::Point* point); |
| - // Applies the reverse transformation on the point. Returns true if the point |
| - // is transformed successfully. |
| + // Applies the reverse transformation on the point. Returns true if the |
| + // transformation can be inverted |
| bool TransformPointReverse(gfx::Point* point); |
| // Applies transformation on the rectangle. Returns true if the rectangle is |
| @@ -86,10 +83,14 @@ class Transform { |
| bool TransformRectReverse(gfx::Rect* rect); |
| // Returns the underlying matrix. |
| - const SkMatrix& matrix() const { return matrix_; } |
| + const SkMatrix44& matrix() const { return matrix_; } |
| private: |
| - SkMatrix matrix_; |
| + void TransformPointInternal(const SkMatrix44& xform, gfx::Point* point); |
| + bool ComputeInverse(); |
| + SkMatrix44 matrix_; |
|
sky
2011/06/09 17:20:29
newline between 90 and 91.
|
| + SkMatrix44 inverse_; |
| + bool hasInverse_; |
| // copy/assign are allowed. |
| }; |