Index: ui/gfx/transform.h |
diff --git a/ui/gfx/transform.h b/ui/gfx/transform.h |
index 3fdfc3235a36c79eab4508d7481e9c05e8a83278..fe8d37aa88a0b6adb273fe13e877d555a465983a 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); |
rjkroege
2011/06/10 17:52:14
why did we lose the boolean prop?
|
// 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,15 @@ 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_; |
+ SkMatrix44 inverse_; |
rjkroege
2011/06/10 17:52:14
time/space overhead of keeping the inverse?
|
+ bool hasInverse_; |
// copy/assign are allowed. |
}; |