Index: ui/gfx/transform.h |
diff --git a/ui/gfx/transform.h b/ui/gfx/transform.h |
index 95de30fa3f4c0d3275c19cd61c3e4663f232c38f..b8635b60f3adc0511c4ea3e893f77cd1d4597636 100644 |
--- a/ui/gfx/transform.h |
+++ b/ui/gfx/transform.h |
@@ -37,6 +37,18 @@ class UI_EXPORT Transform { |
// Initialize with the concatenation of lhs * rhs. |
Transform(const Transform& lhs, const Transform& rhs) |
: matrix_(lhs.matrix_, rhs.matrix_) {} |
+ // Constructs a transform from explicit 16 matrix elements. NOTE: Elements |
danakj
2013/01/11 04:14:12
nit: drop the NOTE? the variable names kinda say t
|
+ // should be given in row-major order. |
+ Transform(double col1row1, double col2row1, double col3row1, double col4row1, |
+ double col1row2, double col2row2, double col3row2, double col4row2, |
+ double col1row3, double col2row3, double col3row3, double col4row3, |
+ double col1row4, double col2row4, double col3row4, double col4row4); |
+ // Constructs a transform from explicit 2d elements. All other matrix |
+ // elements remain the same as the corresponding elements of an identity |
+ // matrix. |
+ Transform(double col1row1, double col2row1, |
+ double col1row2, double col2row2, |
+ double x_translation, double y_translation); |
~Transform() {} |
bool operator==(const Transform& rhs) const { return matrix_ == rhs.matrix_; } |
@@ -120,6 +132,22 @@ class UI_EXPORT Transform { |
// Transposes this transform in place. |
void Transpose(); |
+ // Set 3rd row and 3rd colum to (0, 0, 1, 0). Note that this flattening |
+ // operation is not quite the same as an orthographic projection and is |
+ // technically not a linear operation. |
+ // |
+ // One useful interpretation of doing this operation: |
+ // - For x and y values, the new transform behaves effectively like an |
+ // orthographic projection was added to the matrix sequence. |
+ // - For z values, the new transform overrides any effect that the transform |
+ // had on z, and instead it preserves the z value for any points that are |
+ // transformed. |
+ // - Because of linearity of transforms, this flattened transform also |
+ // preserves the effect that any subsequent (multiplied from the right) |
+ // transforms would have on z values. |
+ // |
+ void FlattenTo2d(); |
+ |
// Applies the transformation on the point. Returns true if the point is |
// transformed successfully. |
void TransformPoint(Point3F& point) const; |