[email protected] | 3c2196b2 | 2012-03-17 03:42:25 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 36df22b | 2011-02-24 21:47:56 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef UI_GFX_TRANSFORM_H_ |
| 6 | #define UI_GFX_TRANSFORM_H_ |
[email protected] | 36df22b | 2011-02-24 21:47:56 | [diff] [blame] | 7 | |
[email protected] | a109fd0 | 2014-07-10 07:41:43 | [diff] [blame] | 8 | #include <iosfwd> |
[email protected] | 6ab42d9 | 2012-12-20 20:36:53 | [diff] [blame] | 9 | #include <string> |
| 10 | |
[email protected] | 4512792 | 2012-11-17 12:24:49 | [diff] [blame] | 11 | #include "base/compiler_specific.h" |
reed | e3d45123 | 2016-05-05 23:29:38 | [diff] [blame] | 12 | #include "third_party/skia/include/core/SkMatrix44.h" |
tfarina | 93bfa91 | 2014-12-05 14:23:15 | [diff] [blame] | 13 | #include "ui/gfx/geometry/vector2d_f.h" |
[email protected] | d34e407 | 2013-09-05 20:28:30 | [diff] [blame] | 14 | #include "ui/gfx/gfx_export.h" |
[email protected] | b9b1e7a4 | 2011-05-17 15:29:51 | [diff] [blame] | 15 | |
[email protected] | 36df22b | 2011-02-24 21:47:56 | [diff] [blame] | 16 | namespace gfx { |
[email protected] | 0f0453e | 2012-10-14 18:15:35 | [diff] [blame] | 17 | |
[email protected] | f4d2b901 | 2013-10-11 19:10:50 | [diff] [blame] | 18 | class BoxF; |
[email protected] | 79fbdab0 | 2012-11-14 07:28:11 | [diff] [blame] | 19 | class RectF; |
[email protected] | 80248e3 | 2011-07-08 15:31:11 | [diff] [blame] | 20 | class Point; |
[email protected] | 2771b1c | 2012-10-31 05:15:43 | [diff] [blame] | 21 | class Point3F; |
[email protected] | f7c321eb | 2012-11-26 20:13:08 | [diff] [blame] | 22 | class Vector3dF; |
[email protected] | 36df22b | 2011-02-24 21:47:56 | [diff] [blame] | 23 | |
[email protected] | 80248e3 | 2011-07-08 15:31:11 | [diff] [blame] | 24 | // 4x4 transformation matrix. Transform is cheap and explicitly allows |
[email protected] | b9b1e7a4 | 2011-05-17 15:29:51 | [diff] [blame] | 25 | // copy/assign. |
[email protected] | 4ffa789 | 2013-09-27 16:56:06 | [diff] [blame] | 26 | class GFX_EXPORT Transform { |
[email protected] | 36df22b | 2011-02-24 21:47:56 | [diff] [blame] | 27 | public: |
[email protected] | bda4196 | 2013-01-07 18:46:17 | [diff] [blame] | 28 | |
| 29 | enum SkipInitialization { |
| 30 | kSkipInitialization |
| 31 | }; |
| 32 | |
[email protected] | 0db1322 | 2012-12-13 21:27:54 | [diff] [blame] | 33 | Transform() : matrix_(SkMatrix44::kIdentity_Constructor) {} |
[email protected] | bda4196 | 2013-01-07 18:46:17 | [diff] [blame] | 34 | |
| 35 | // Skips initializing this matrix to avoid overhead, when we know it will be |
| 36 | // initialized before use. |
| 37 | Transform(SkipInitialization) |
| 38 | : matrix_(SkMatrix44::kUninitialized_Constructor) {} |
[email protected] | 0db1322 | 2012-12-13 21:27:54 | [diff] [blame] | 39 | Transform(const Transform& rhs) : matrix_(rhs.matrix_) {} |
[email protected] | d9a6f330 | 2012-12-07 19:17:54 | [diff] [blame] | 40 | // Initialize with the concatenation of lhs * rhs. |
[email protected] | 0db1322 | 2012-12-13 21:27:54 | [diff] [blame] | 41 | Transform(const Transform& lhs, const Transform& rhs) |
| 42 | : matrix_(lhs.matrix_, rhs.matrix_) {} |
vollick | 9c7f6d0 | 2016-01-08 04:36:38 | [diff] [blame] | 43 | explicit Transform(const SkMatrix44& matrix) : matrix_(matrix) {} |
[email protected] | 78634b0c | 2013-01-15 07:49:40 | [diff] [blame] | 44 | // Constructs a transform from explicit 16 matrix elements. Elements |
| 45 | // should be given in row-major order. |
[email protected] | 803f6b5 | 2013-09-12 00:51:26 | [diff] [blame] | 46 | Transform(SkMScalar col1row1, |
| 47 | SkMScalar col2row1, |
| 48 | SkMScalar col3row1, |
| 49 | SkMScalar col4row1, |
| 50 | SkMScalar col1row2, |
| 51 | SkMScalar col2row2, |
| 52 | SkMScalar col3row2, |
| 53 | SkMScalar col4row2, |
| 54 | SkMScalar col1row3, |
| 55 | SkMScalar col2row3, |
| 56 | SkMScalar col3row3, |
| 57 | SkMScalar col4row3, |
| 58 | SkMScalar col1row4, |
| 59 | SkMScalar col2row4, |
| 60 | SkMScalar col3row4, |
| 61 | SkMScalar col4row4); |
[email protected] | 78634b0c | 2013-01-15 07:49:40 | [diff] [blame] | 62 | // Constructs a transform from explicit 2d elements. All other matrix |
| 63 | // elements remain the same as the corresponding elements of an identity |
| 64 | // matrix. |
[email protected] | 803f6b5 | 2013-09-12 00:51:26 | [diff] [blame] | 65 | Transform(SkMScalar col1row1, |
| 66 | SkMScalar col2row1, |
| 67 | SkMScalar col1row2, |
| 68 | SkMScalar col2row2, |
| 69 | SkMScalar x_translation, |
| 70 | SkMScalar y_translation); |
[email protected] | 36df22b | 2011-02-24 21:47:56 | [diff] [blame] | 71 | |
[email protected] | 0db1322 | 2012-12-13 21:27:54 | [diff] [blame] | 72 | bool operator==(const Transform& rhs) const { return matrix_ == rhs.matrix_; } |
| 73 | bool operator!=(const Transform& rhs) const { return matrix_ != rhs.matrix_; } |
[email protected] | 80248e3 | 2011-07-08 15:31:11 | [diff] [blame] | 74 | |
[email protected] | f7c321eb | 2012-11-26 20:13:08 | [diff] [blame] | 75 | // Resets this transform to the identity transform. |
[email protected] | 0db1322 | 2012-12-13 21:27:54 | [diff] [blame] | 76 | void MakeIdentity() { matrix_.setIdentity(); } |
[email protected] | 2fcafa0 | 2012-11-15 01:12:55 | [diff] [blame] | 77 | |
[email protected] | 2c7cd6d | 2012-11-28 23:49:26 | [diff] [blame] | 78 | // Applies the current transformation on a 2d rotation and assigns the result |
[email protected] | 2fcafa0 | 2012-11-15 01:12:55 | [diff] [blame] | 79 | // to |this|. |
[email protected] | 2c7cd6d | 2012-11-28 23:49:26 | [diff] [blame] | 80 | void Rotate(double degrees) { RotateAboutZAxis(degrees); } |
[email protected] | 2fcafa0 | 2012-11-15 01:12:55 | [diff] [blame] | 81 | |
| 82 | // Applies the current transformation on an axis-angle rotation and assigns |
| 83 | // the result to |this|. |
[email protected] | 2c7cd6d | 2012-11-28 23:49:26 | [diff] [blame] | 84 | void RotateAboutXAxis(double degrees); |
| 85 | void RotateAboutYAxis(double degrees); |
| 86 | void RotateAboutZAxis(double degrees); |
| 87 | void RotateAbout(const Vector3dF& axis, double degrees); |
[email protected] | 2fcafa0 | 2012-11-15 01:12:55 | [diff] [blame] | 88 | |
| 89 | // Applies the current transformation on a scaling and assigns the result |
| 90 | // to |this|. |
[email protected] | 803f6b5 | 2013-09-12 00:51:26 | [diff] [blame] | 91 | void Scale(SkMScalar x, SkMScalar y); |
| 92 | void Scale3d(SkMScalar x, SkMScalar y, SkMScalar z); |
[email protected] | adeda57 | 2014-01-31 00:49:47 | [diff] [blame] | 93 | gfx::Vector2dF Scale2d() const { |
| 94 | return gfx::Vector2dF(matrix_.get(0, 0), matrix_.get(1, 1)); |
| 95 | } |
[email protected] | 2fcafa0 | 2012-11-15 01:12:55 | [diff] [blame] | 96 | |
| 97 | // Applies the current transformation on a translation and assigns the result |
| 98 | // to |this|. |
[email protected] | 803f6b5 | 2013-09-12 00:51:26 | [diff] [blame] | 99 | void Translate(SkMScalar x, SkMScalar y); |
| 100 | void Translate3d(SkMScalar x, SkMScalar y, SkMScalar z); |
[email protected] | 2fcafa0 | 2012-11-15 01:12:55 | [diff] [blame] | 101 | |
| 102 | // Applies the current transformation on a skew and assigns the result |
| 103 | // to |this|. |
nainar | 8ca8ee6 | 2015-09-03 01:04:10 | [diff] [blame] | 104 | void Skew(double angle_x, double angle_y); |
[email protected] | 2fcafa0 | 2012-11-15 01:12:55 | [diff] [blame] | 105 | |
| 106 | // Applies the current transformation on a perspective transform and assigns |
| 107 | // the result to |this|. |
[email protected] | 803f6b5 | 2013-09-12 00:51:26 | [diff] [blame] | 108 | void ApplyPerspectiveDepth(SkMScalar depth); |
[email protected] | 2fcafa0 | 2012-11-15 01:12:55 | [diff] [blame] | 109 | |
[email protected] | b9b1e7a4 | 2011-05-17 15:29:51 | [diff] [blame] | 110 | // Applies a transformation on the current transformation |
[email protected] | 80248e3 | 2011-07-08 15:31:11 | [diff] [blame] | 111 | // (i.e. 'this = this * transform;'). |
| 112 | void PreconcatTransform(const Transform& transform); |
[email protected] | 36df22b | 2011-02-24 21:47:56 | [diff] [blame] | 113 | |
[email protected] | 59808008 | 2011-04-14 19:36:33 | [diff] [blame] | 114 | // Applies a transformation on the current transformation |
[email protected] | 80248e3 | 2011-07-08 15:31:11 | [diff] [blame] | 115 | // (i.e. 'this = transform * this;'). |
| 116 | void ConcatTransform(const Transform& transform); |
[email protected] | 36df22b | 2011-02-24 21:47:56 | [diff] [blame] | 117 | |
[email protected] | 4512792 | 2012-11-17 12:24:49 | [diff] [blame] | 118 | // Returns true if this is the identity matrix. |
[email protected] | d9a6f330 | 2012-12-07 19:17:54 | [diff] [blame] | 119 | bool IsIdentity() const { return matrix_.isIdentity(); } |
[email protected] | 4512792 | 2012-11-17 12:24:49 | [diff] [blame] | 120 | |
[email protected] | 2c7cd6d | 2012-11-28 23:49:26 | [diff] [blame] | 121 | // Returns true if the matrix is either identity or pure translation. |
danakj | 670a4ab | 2014-09-19 19:38:28 | [diff] [blame] | 122 | bool IsIdentityOrTranslation() const { return matrix_.isTranslate(); } |
[email protected] | 2c7cd6d | 2012-11-28 23:49:26 | [diff] [blame] | 123 | |
vollick | 51ed1a2 | 2014-12-17 02:03:00 | [diff] [blame] | 124 | // Returns true if the matrix is either the identity or a 2d translation. |
| 125 | bool IsIdentityOr2DTranslation() const { |
| 126 | return matrix_.isTranslate() && matrix_.get(2, 3) == 0; |
| 127 | } |
| 128 | |
[email protected] | 19f9054 | 2013-10-19 18:26:07 | [diff] [blame] | 129 | // Returns true if the matrix is either identity or pure translation, |
| 130 | // allowing for an amount of inaccuracy as specified by the parameter. |
| 131 | bool IsApproximatelyIdentityOrTranslation(SkMScalar tolerance) const; |
| 132 | |
[email protected] | aedf4e5 | 2013-01-09 23:24:44 | [diff] [blame] | 133 | // Returns true if the matrix is either a positive scale and/or a translation. |
| 134 | bool IsPositiveScaleOrTranslation() const { |
| 135 | if (!IsScaleOrTranslation()) |
| 136 | return false; |
[email protected] | 803f6b5 | 2013-09-12 00:51:26 | [diff] [blame] | 137 | return matrix_.get(0, 0) > 0.0 && matrix_.get(1, 1) > 0.0 && |
| 138 | matrix_.get(2, 2) > 0.0; |
[email protected] | aedf4e5 | 2013-01-09 23:24:44 | [diff] [blame] | 139 | } |
| 140 | |
[email protected] | d1a56f0 | 2012-12-04 12:18:30 | [diff] [blame] | 141 | // Returns true if the matrix is either identity or pure, non-fractional |
| 142 | // translation. |
| 143 | bool IsIdentityOrIntegerTranslation() const; |
| 144 | |
[email protected] | adeda57 | 2014-01-31 00:49:47 | [diff] [blame] | 145 | // Returns true if the matrix had only scaling components. |
tfarina | 81090b4 | 2014-11-06 14:50:43 | [diff] [blame] | 146 | bool IsScale2d() const { return matrix_.isScale(); } |
[email protected] | adeda57 | 2014-01-31 00:49:47 | [diff] [blame] | 147 | |
[email protected] | 2c7cd6d | 2012-11-28 23:49:26 | [diff] [blame] | 148 | // Returns true if the matrix is has only scaling and translation components. |
danakj | 670a4ab | 2014-09-19 19:38:28 | [diff] [blame] | 149 | bool IsScaleOrTranslation() const { return matrix_.isScaleTranslate(); } |
[email protected] | 2c7cd6d | 2012-11-28 23:49:26 | [diff] [blame] | 150 | |
[email protected] | 3a9a92d | 2013-07-11 04:37:00 | [diff] [blame] | 151 | // Returns true if axis-aligned 2d rects will remain axis-aligned after being |
| 152 | // transformed by this matrix. |
| 153 | bool Preserves2dAxisAlignment() const; |
| 154 | |
[email protected] | 2c7cd6d | 2012-11-28 23:49:26 | [diff] [blame] | 155 | // Returns true if the matrix has any perspective component that would |
| 156 | // change the w-component of a homogeneous point. |
danakj | 670a4ab | 2014-09-19 19:38:28 | [diff] [blame] | 157 | bool HasPerspective() const { return matrix_.hasPerspective(); } |
[email protected] | 2c7cd6d | 2012-11-28 23:49:26 | [diff] [blame] | 158 | |
[email protected] | 4512792 | 2012-11-17 12:24:49 | [diff] [blame] | 159 | // Returns true if this transform is non-singular. |
[email protected] | 0db1322 | 2012-12-13 21:27:54 | [diff] [blame] | 160 | bool IsInvertible() const { return matrix_.invert(NULL); } |
[email protected] | 36df22b | 2011-02-24 21:47:56 | [diff] [blame] | 161 | |
[email protected] | 2c7cd6d | 2012-11-28 23:49:26 | [diff] [blame] | 162 | // Returns true if a layer with a forward-facing normal of (0, 0, 1) would |
| 163 | // have its back side facing frontwards after applying the transform. |
| 164 | bool IsBackFaceVisible() const; |
| 165 | |
[email protected] | 3891939 | 2011-10-24 22:26:23 | [diff] [blame] | 166 | // Inverts the transform which is passed in. Returns true if successful. |
[email protected] | 4512792 | 2012-11-17 12:24:49 | [diff] [blame] | 167 | bool GetInverse(Transform* transform) const WARN_UNUSED_RESULT; |
| 168 | |
| 169 | // Transposes this transform in place. |
| 170 | void Transpose(); |
[email protected] | 3891939 | 2011-10-24 22:26:23 | [diff] [blame] | 171 | |
[email protected] | 78634b0c | 2013-01-15 07:49:40 | [diff] [blame] | 172 | // Set 3rd row and 3rd colum to (0, 0, 1, 0). Note that this flattening |
| 173 | // operation is not quite the same as an orthographic projection and is |
| 174 | // technically not a linear operation. |
| 175 | // |
| 176 | // One useful interpretation of doing this operation: |
| 177 | // - For x and y values, the new transform behaves effectively like an |
| 178 | // orthographic projection was added to the matrix sequence. |
| 179 | // - For z values, the new transform overrides any effect that the transform |
| 180 | // had on z, and instead it preserves the z value for any points that are |
| 181 | // transformed. |
| 182 | // - Because of linearity of transforms, this flattened transform also |
| 183 | // preserves the effect that any subsequent (multiplied from the right) |
| 184 | // transforms would have on z values. |
| 185 | // |
| 186 | void FlattenTo2d(); |
| 187 | |
ajuma | d0d6442 | 2015-03-14 04:20:08 | [diff] [blame] | 188 | // Returns true if the 3rd row and 3rd column are both (0, 0, 1, 0). |
| 189 | bool IsFlat() const; |
| 190 | |
[email protected] | d81752b | 2013-10-25 08:32:23 | [diff] [blame] | 191 | // Returns the x and y translation components of the matrix. |
[email protected] | bea4c87 | 2013-08-14 18:10:00 | [diff] [blame] | 192 | Vector2dF To2dTranslation() const; |
| 193 | |
[email protected] | 908af42 | 2013-10-10 22:22:42 | [diff] [blame] | 194 | // Applies the transformation to the point. |
[email protected] | 26d7ece | 2013-09-12 20:59:47 | [diff] [blame] | 195 | void TransformPoint(Point3F* point) const; |
[email protected] | 36df22b | 2011-02-24 21:47:56 | [diff] [blame] | 196 | |
[email protected] | 908af42 | 2013-10-10 22:22:42 | [diff] [blame] | 197 | // Applies the transformation to the point. |
[email protected] | 26d7ece | 2013-09-12 20:59:47 | [diff] [blame] | 198 | void TransformPoint(Point* point) const; |
[email protected] | 36df22b | 2011-02-24 21:47:56 | [diff] [blame] | 199 | |
petermayo | 59d3768 | 2016-04-13 14:37:35 | [diff] [blame] | 200 | // Applies the transformation to the vector. |
| 201 | void TransformVector(Vector3dF* vector) const; |
| 202 | |
[email protected] | 80248e3 | 2011-07-08 15:31:11 | [diff] [blame] | 203 | // Applies the reverse transformation on the point. Returns true if the |
| 204 | // transformation can be inverted. |
[email protected] | 26d7ece | 2013-09-12 20:59:47 | [diff] [blame] | 205 | bool TransformPointReverse(Point3F* point) const; |
[email protected] | 463eb0e | 2011-05-10 03:11:04 | [diff] [blame] | 206 | |
[email protected] | 80248e3 | 2011-07-08 15:31:11 | [diff] [blame] | 207 | // Applies the reverse transformation on the point. Returns true if the |
| 208 | // transformation can be inverted. Rounds the result to the nearest point. |
[email protected] | 26d7ece | 2013-09-12 20:59:47 | [diff] [blame] | 209 | bool TransformPointReverse(Point* point) const; |
[email protected] | 80248e3 | 2011-07-08 15:31:11 | [diff] [blame] | 210 | |
[email protected] | f4d2b901 | 2013-10-11 19:10:50 | [diff] [blame] | 211 | // Applies transformation on the given rect. After the function completes, |
| 212 | // |rect| will be the smallest axis aligned bounding rect containing the |
| 213 | // transformed rect. |
[email protected] | 79fbdab0 | 2012-11-14 07:28:11 | [diff] [blame] | 214 | void TransformRect(RectF* rect) const; |
[email protected] | 80248e3 | 2011-07-08 15:31:11 | [diff] [blame] | 215 | |
[email protected] | f4d2b901 | 2013-10-11 19:10:50 | [diff] [blame] | 216 | // Applies the reverse transformation on the given rect. After the function |
| 217 | // completes, |rect| will be the smallest axis aligned bounding rect |
| 218 | // containing the transformed rect. Returns false if the matrix cannot be |
| 219 | // inverted. |
[email protected] | 79fbdab0 | 2012-11-14 07:28:11 | [diff] [blame] | 220 | bool TransformRectReverse(RectF* rect) const; |
[email protected] | 277c7b7 | 2011-06-06 15:23:09 | [diff] [blame] | 221 | |
[email protected] | f4d2b901 | 2013-10-11 19:10:50 | [diff] [blame] | 222 | // Applies transformation on the given box. After the function completes, |
| 223 | // |box| will be the smallest axis aligned bounding box containing the |
| 224 | // transformed box. |
| 225 | void TransformBox(BoxF* box) const; |
| 226 | |
| 227 | // Applies the reverse transformation on the given box. After the function |
| 228 | // completes, |box| will be the smallest axis aligned bounding box |
| 229 | // containing the transformed box. Returns false if the matrix cannot be |
| 230 | // inverted. |
| 231 | bool TransformBoxReverse(BoxF* box) const; |
| 232 | |
[email protected] | 2fcafa0 | 2012-11-15 01:12:55 | [diff] [blame] | 233 | // Decomposes |this| and |from|, interpolates the decomposed values, and |
| 234 | // sets |this| to the reconstituted result. Returns false if either matrix |
| 235 | // can't be decomposed. Uses routines described in this spec: |
| 236 | // http://www.w3.org/TR/css3-3d-transforms/. |
| 237 | // |
| 238 | // Note: this call is expensive since we need to decompose the transform. If |
| 239 | // you're going to be calling this rapidly (e.g., in an animation) you should |
| 240 | // decompose once using gfx::DecomposeTransforms and reuse your |
| 241 | // DecomposedTransform. |
[email protected] | 6138db70 | 2013-09-25 03:25:05 | [diff] [blame] | 242 | bool Blend(const Transform& from, double progress); |
[email protected] | 2fcafa0 | 2012-11-15 01:12:55 | [diff] [blame] | 243 | |
vollick | b169ff62 | 2015-02-10 01:22:33 | [diff] [blame] | 244 | void RoundTranslationComponents(); |
| 245 | |
[email protected] | f7c321eb | 2012-11-26 20:13:08 | [diff] [blame] | 246 | // Returns |this| * |other|. |
[email protected] | d9a6f330 | 2012-12-07 19:17:54 | [diff] [blame] | 247 | Transform operator*(const Transform& other) const { |
| 248 | return Transform(*this, other); |
| 249 | } |
[email protected] | f7c321eb | 2012-11-26 20:13:08 | [diff] [blame] | 250 | |
| 251 | // Sets |this| = |this| * |other| |
[email protected] | 0db1322 | 2012-12-13 21:27:54 | [diff] [blame] | 252 | Transform& operator*=(const Transform& other) { |
| 253 | PreconcatTransform(other); |
| 254 | return *this; |
| 255 | } |
[email protected] | f7c321eb | 2012-11-26 20:13:08 | [diff] [blame] | 256 | |
[email protected] | b9b1e7a4 | 2011-05-17 15:29:51 | [diff] [blame] | 257 | // Returns the underlying matrix. |
[email protected] | 80248e3 | 2011-07-08 15:31:11 | [diff] [blame] | 258 | const SkMatrix44& matrix() const { return matrix_; } |
| 259 | SkMatrix44& matrix() { return matrix_; } |
jaydasika | cb93d1c | 2015-12-09 23:52:46 | [diff] [blame] | 260 | bool ApproximatelyEqual(const gfx::Transform& transform) const; |
[email protected] | b9b1e7a4 | 2011-05-17 15:29:51 | [diff] [blame] | 261 | |
[email protected] | 6ab42d9 | 2012-12-20 20:36:53 | [diff] [blame] | 262 | std::string ToString() const; |
| 263 | |
[email protected] | b9b1e7a4 | 2011-05-17 15:29:51 | [diff] [blame] | 264 | private: |
[email protected] | 80248e3 | 2011-07-08 15:31:11 | [diff] [blame] | 265 | void TransformPointInternal(const SkMatrix44& xform, |
[email protected] | 26d7ece | 2013-09-12 20:59:47 | [diff] [blame] | 266 | Point* point) const; |
[email protected] | 80248e3 | 2011-07-08 15:31:11 | [diff] [blame] | 267 | |
| 268 | void TransformPointInternal(const SkMatrix44& xform, |
[email protected] | 26d7ece | 2013-09-12 20:59:47 | [diff] [blame] | 269 | Point3F* point) const; |
[email protected] | 80248e3 | 2011-07-08 15:31:11 | [diff] [blame] | 270 | |
petermayo | 59d3768 | 2016-04-13 14:37:35 | [diff] [blame] | 271 | void TransformVectorInternal(const SkMatrix44& xform, |
| 272 | Vector3dF* vector) const; |
| 273 | |
[email protected] | 80248e3 | 2011-07-08 15:31:11 | [diff] [blame] | 274 | SkMatrix44 matrix_; |
[email protected] | b9b1e7a4 | 2011-05-17 15:29:51 | [diff] [blame] | 275 | |
| 276 | // copy/assign are allowed. |
[email protected] | 36df22b | 2011-02-24 21:47:56 | [diff] [blame] | 277 | }; |
| 278 | |
[email protected] | a109fd0 | 2014-07-10 07:41:43 | [diff] [blame] | 279 | // This is declared here for use in gtest-based unit tests but is defined in |
| 280 | // the gfx_test_support target. Depend on that to use this in your unit test. |
| 281 | // This should not be used in production code - call ToString() instead. |
| 282 | void PrintTo(const Transform& transform, ::std::ostream* os); |
| 283 | |
[email protected] | 0f0453e | 2012-10-14 18:15:35 | [diff] [blame] | 284 | } // namespace gfx |
[email protected] | 36df22b | 2011-02-24 21:47:56 | [diff] [blame] | 285 | |
| 286 | #endif // UI_GFX_TRANSFORM_H_ |