| Index: ui/gfx/transform.h
|
| diff --git a/ui/gfx/transform.h b/ui/gfx/transform.h
|
| index c3f86ef04f821e4743cd21634bd3a09a0e895495..1482fb7e9c85c1e1b4996e0ae1ba33e5caa2d09e 100644
|
| --- a/ui/gfx/transform.h
|
| +++ b/ui/gfx/transform.h
|
| @@ -6,25 +6,26 @@
|
| #define UI_GFX_TRANSFORM_H_
|
| #pragma once
|
|
|
| -#include "base/basictypes.h"
|
| -#include "base/compiler_specific.h"
|
| -#include "third_party/skia/include/core/SkMatrix.h"
|
| +#include "third_party/skia/include/utils/SkMatrix44.h"
|
|
|
| namespace gfx {
|
| -class Point;
|
| class Rect;
|
| +class Point;
|
| +class Point3f;
|
| }
|
|
|
| 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();
|
| ~Transform();
|
|
|
| + bool operator==(const Transform& rhs) const;
|
| + bool operator!=(const Transform& rhs) const;
|
| +
|
| // NOTE: The 'Set' functions overwrite the previously set transformation
|
| // parameters. The 'Concat' functions apply a transformation (e.g. rotation,
|
| // scale, translate) on top of the existing transforms, instead of overwriting
|
| @@ -57,44 +58,59 @@ 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) const;
|
| + void TransformPoint(gfx::Point3f& point) const;
|
|
|
| - // Applies the reverse transformation on the point. Returns true if the point
|
| - // is transformed successfully.
|
| - bool TransformPointReverse(gfx::Point* point) const;
|
| -
|
| - // Applies transformation on the rectangle. Returns true if the rectangle is
|
| - // transformed successfully.
|
| - bool TransformRect(gfx::Rect* rect) const;
|
| -
|
| - // Applies the reverse transformation on the rectangle. Returns true if the
|
| - // rectangle is transformed successfully.
|
| + // Applies the transformation on the point. Returns true if the point is
|
| + // transformed successfully. Rounds the result to the nearest point.
|
| + void TransformPoint(gfx::Point& point) const;
|
| +
|
| + // Applies the reverse transformation on the point. Returns true if the
|
| + // transformation can be inverted.
|
| + bool TransformPointReverse(gfx::Point3f& point) const;
|
| +
|
| + // Applies the reverse transformation on the point. Returns true if the
|
| + // transformation can be inverted. Rounds the result to the nearest point.
|
| + bool TransformPointReverse(gfx::Point& point) const;
|
| +
|
| + // Applies transformation on the rectangle. Returns true if the transformed
|
| + // rectangle was axis aligned. If it returns false, rect will be the
|
| + // smallest axis aligned bounding box containg the transformed rect.
|
| + void TransformRect(gfx::Rect* rect) const;
|
| +
|
| + // Applies the reverse transformation on the rectangle. Returns true if
|
| + // the transformed rectangle was axis aligned. If it returns false,
|
| + // rect will be the smallest axis aligned bounding box containg the
|
| + // transformed rect.
|
| bool TransformRectReverse(gfx::Rect* rect) const;
|
|
|
| // Returns the underlying matrix.
|
| - const SkMatrix& matrix() const { return matrix_; }
|
| - SkMatrix& matrix() { return matrix_; }
|
| + const SkMatrix44& matrix() const { return matrix_; }
|
| + SkMatrix44& matrix() { return matrix_; }
|
|
|
| private:
|
| - SkMatrix matrix_;
|
| + void TransformPointInternal(const SkMatrix44& xform,
|
| + gfx::Point& point) const;
|
| +
|
| + void TransformPointInternal(const SkMatrix44& xform,
|
| + gfx::Point3f& point) const;
|
| +
|
| + SkMatrix44 matrix_;
|
|
|
| // copy/assign are allowed.
|
| };
|
|
|
| -} // namespace ui
|
| +}// namespace ui
|
|
|
| #endif // UI_GFX_TRANSFORM_H_
|
|
|