OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 void setM41(double f) { m_matrix->setM41(f); } | 92 void setM41(double f) { m_matrix->setM41(f); } |
93 void setM42(double f) { m_matrix->setM42(f); } | 93 void setM42(double f) { m_matrix->setM42(f); } |
94 void setM43(double f) { m_matrix->setM43(f); } | 94 void setM43(double f) { m_matrix->setM43(f); } |
95 void setM44(double f) { m_matrix->setM44(f); } | 95 void setM44(double f) { m_matrix->setM44(f); } |
96 | 96 |
97 void setMatrixValue(const String&, ExceptionState&); | 97 void setMatrixValue(const String&, ExceptionState&); |
98 | 98 |
99 // The following math function return a new matrix with the | 99 // The following math function return a new matrix with the |
100 // specified operation applied. The this value is not modified. | 100 // specified operation applied. The this value is not modified. |
101 | 101 |
102 // Multiply this matrix by secondMatrix, on the right (result = this * secondM
atrix) | 102 // Multiply this matrix by secondMatrix, on the right |
| 103 // (result = this * secondMatrix) |
103 CSSMatrix* multiply(CSSMatrix* secondMatrix) const; | 104 CSSMatrix* multiply(CSSMatrix* secondMatrix) const; |
104 | 105 |
105 // Return the inverse of this matrix. Throw an exception if the matrix is not
invertible | 106 // Return the inverse of this matrix. Throw an exception if the matrix is not |
| 107 // invertible. |
106 CSSMatrix* inverse(ExceptionState&) const; | 108 CSSMatrix* inverse(ExceptionState&) const; |
107 | 109 |
108 // Return this matrix translated by the passed values. | 110 // Return this matrix translated by the passed values. |
109 // Passing a NaN will use a value of 0. This allows the 3D form to used for 2D
operations | 111 // Passing a NaN will use a value of 0. This allows the 3D form to used for 2D |
110 // Operation is performed as though the this matrix is multiplied by a matrix
with | 112 // operations. |
111 // the translation values on the left (result = translation(x,y,z) * this) | 113 // Operation is performed as though the this matrix is multiplied by a matrix |
| 114 // with the translation values on the left |
| 115 // (result = translation(x,y,z) * this) |
112 CSSMatrix* translate(double x, double y, double z) const; | 116 CSSMatrix* translate(double x, double y, double z) const; |
113 | 117 |
114 // Returns this matrix scaled by the passed values. | 118 // Returns this matrix scaled by the passed values. |
115 // Passing scaleX or scaleZ as NaN uses a value of 1, but passing scaleY of Na
N | 119 // Passing scaleX or scaleZ as NaN uses a value of 1, but passing scaleY of |
116 // makes it the same as scaleX. This allows the 3D form to used for 2D operati
ons | 120 // NaN makes it the same as scaleX. This allows the 3D form to used for 2D |
117 // Operation is performed as though the this matrix is multiplied by a matrix
with | 121 // operations Operation is performed as though the this matrix is multiplied |
118 // the scale values on the left (result = scale(x,y,z) * this) | 122 // by a matrix with the scale values on the left |
| 123 // (result = scale(x,y,z) * this) |
119 CSSMatrix* scale(double scaleX, double scaleY, double scaleZ) const; | 124 CSSMatrix* scale(double scaleX, double scaleY, double scaleZ) const; |
120 | 125 |
121 // Returns this matrix rotated by the passed values. | 126 // Returns this matrix rotated by the passed values. |
122 // If rotY and rotZ are NaN, rotate about Z (rotX=0, rotateY=0, rotateZ=rotX). | 127 // If rotY and rotZ are NaN, rotate about Z (rotX=0, rotateY=0, rotateZ=rotX). |
123 // Otherwise use a rotation value of 0 for any passed NaN. | 128 // Otherwise use a rotation value of 0 for any passed NaN. |
124 // Operation is performed as though the this matrix is multiplied by a matrix
with | 129 // Operation is performed as though the this matrix is multiplied by a matrix |
125 // the rotation values on the left (result = rotation(x,y,z) * this) | 130 // with the rotation values on the left (result = rotation(x,y,z) * this) |
126 CSSMatrix* rotate(double rotX, double rotY, double rotZ) const; | 131 CSSMatrix* rotate(double rotX, double rotY, double rotZ) const; |
127 | 132 |
128 // Returns this matrix rotated about the passed axis by the passed angle. | 133 // Returns this matrix rotated about the passed axis by the passed angle. |
129 // Passing a NaN will use a value of 0. If the axis is (0,0,0) use a value | 134 // Passing a NaN will use a value of 0. If the axis is (0,0,0) use a value |
130 // Operation is performed as though the this matrix is multiplied by a matrix
with | 135 // Operation is performed as though the this matrix is multiplied by a matrix |
131 // the rotation values on the left (result = rotation(x,y,z,angle) * this) | 136 // with the rotation values on the left |
| 137 // (result = rotation(x,y,z,angle) * this) |
132 CSSMatrix* rotateAxisAngle(double x, double y, double z, double angle) const; | 138 CSSMatrix* rotateAxisAngle(double x, double y, double z, double angle) const; |
133 | 139 |
134 // Return this matrix skewed along the X axis by the passed values. | 140 // Return this matrix skewed along the X axis by the passed values. |
135 // Passing a NaN will use a value of 0. | 141 // Passing a NaN will use a value of 0. |
136 // Operation is performed as though the this matrix is multiplied by a matrix
with | 142 // Operation is performed as though the this matrix is multiplied by a matrix |
137 // the skew values on the left (result = skewX(angle) * this) | 143 // with the skew values on the left (result = skewX(angle) * this) |
138 CSSMatrix* skewX(double angle) const; | 144 CSSMatrix* skewX(double angle) const; |
139 | 145 |
140 // Return this matrix skewed along the Y axis by the passed values. | 146 // Return this matrix skewed along the Y axis by the passed values. |
141 // Passing a NaN will use a value of 0. | 147 // Passing a NaN will use a value of 0. |
142 // Operation is performed as though the this matrix is multiplied by a matrix
with | 148 // Operation is performed as though the this matrix is multiplied by a matrix |
143 // the skew values on the left (result = skewY(angle) * this) | 149 // with the skew values on the left (result = skewY(angle) * this) |
144 CSSMatrix* skewY(double angle) const; | 150 CSSMatrix* skewY(double angle) const; |
145 | 151 |
146 const TransformationMatrix& transform() const { return *m_matrix; } | 152 const TransformationMatrix& transform() const { return *m_matrix; } |
147 | 153 |
148 String toString() const; | 154 String toString() const; |
149 | 155 |
150 DEFINE_INLINE_TRACE() {} | 156 DEFINE_INLINE_TRACE() {} |
151 | 157 |
152 protected: | 158 protected: |
153 CSSMatrix(const TransformationMatrix&); | 159 CSSMatrix(const TransformationMatrix&); |
154 CSSMatrix(const String&, ExceptionState&); | 160 CSSMatrix(const String&, ExceptionState&); |
155 | 161 |
156 // TransformationMatrix needs to be 16-byte aligned. PartitionAlloc | 162 // TransformationMatrix needs to be 16-byte aligned. PartitionAlloc |
157 // supports 16-byte alignment but Oilpan doesn't. So we use an std::unique_ptr | 163 // supports 16-byte alignment but Oilpan doesn't. So we use an std::unique_ptr |
158 // to allocate TransformationMatrix on PartitionAlloc. | 164 // to allocate TransformationMatrix on PartitionAlloc. |
159 // TODO(oilpan): Oilpan should support 16-byte aligned allocations. | 165 // TODO(oilpan): Oilpan should support 16-byte aligned allocations. |
160 std::unique_ptr<TransformationMatrix> m_matrix; | 166 std::unique_ptr<TransformationMatrix> m_matrix; |
161 }; | 167 }; |
162 | 168 |
163 } // namespace blink | 169 } // namespace blink |
164 | 170 |
165 #endif // CSSMatrix_h | 171 #endif // CSSMatrix_h |
OLD | NEW |