OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/dom/DOMMatrix.h" | 5 #include "core/dom/DOMMatrix.h" |
6 | 6 |
7 namespace blink { | 7 namespace blink { |
8 | 8 |
9 DOMMatrix* DOMMatrix::create(ExceptionState& exceptionState) { | 9 DOMMatrix* DOMMatrix::create(ExceptionState& exceptionState) { |
10 return new DOMMatrix(TransformationMatrix()); | 10 return new DOMMatrix(TransformationMatrix()); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 m_is2D = false; | 118 m_is2D = false; |
119 | 119 |
120 if (m_is2D) | 120 if (m_is2D) |
121 m_matrix->translate(tx, ty); | 121 m_matrix->translate(tx, ty); |
122 else | 122 else |
123 m_matrix->translate3d(tx, ty, tz); | 123 m_matrix->translate3d(tx, ty, tz); |
124 | 124 |
125 return this; | 125 return this; |
126 } | 126 } |
127 | 127 |
128 DOMMatrix* DOMMatrix::scaleSelf(double scale, double ox, double oy) { | 128 DOMMatrix* DOMMatrix::scaleSelf(double sx) { |
129 return scaleNonUniformSelf(scale, scale, 1, ox, oy); | 129 return scaleSelf(sx, sx); |
130 } | 130 } |
131 | 131 |
132 DOMMatrix* DOMMatrix::scale3dSelf(double scale, | 132 DOMMatrix* DOMMatrix::scaleSelf(double sx, |
133 double ox, | 133 double sy, |
134 double oy, | 134 double sz, |
135 double oz) { | 135 double ox, |
136 return scaleNonUniformSelf(scale, scale, scale, ox, oy, oz); | 136 double oy, |
137 } | 137 double oz) { |
138 | |
139 DOMMatrix* DOMMatrix::scaleNonUniformSelf(double sx, | |
140 double sy, | |
141 double sz, | |
142 double ox, | |
143 double oy, | |
144 double oz) { | |
145 if (sz != 1 || oz) | 138 if (sz != 1 || oz) |
146 m_is2D = false; | 139 m_is2D = false; |
147 | 140 |
148 if (sx == 1 && sy == 1 && sz == 1) | 141 if (sx == 1 && sy == 1 && sz == 1) |
149 return this; | 142 return this; |
150 | 143 |
151 bool hasTranslation = (ox || oy || oz); | 144 bool hasTranslation = (ox || oy || oz); |
152 | 145 |
153 if (hasTranslation) | 146 if (hasTranslation) |
154 translateSelf(ox, oy, oz); | 147 translateSelf(ox, oy, oz); |
155 | 148 |
156 if (m_is2D) | 149 if (m_is2D) |
157 m_matrix->scaleNonUniform(sx, sy); | 150 m_matrix->scaleNonUniform(sx, sy); |
158 else | 151 else |
159 m_matrix->scale3d(sx, sy, sz); | 152 m_matrix->scale3d(sx, sy, sz); |
160 | 153 |
161 if (hasTranslation) | 154 if (hasTranslation) |
162 translateSelf(-ox, -oy, -oz); | 155 translateSelf(-ox, -oy, -oz); |
163 | 156 |
164 return this; | 157 return this; |
165 } | 158 } |
166 | 159 |
| 160 DOMMatrix* DOMMatrix::scale3dSelf(double scale, |
| 161 double ox, |
| 162 double oy, |
| 163 double oz) { |
| 164 return scaleSelf(scale, scale, scale, ox, oy, oz); |
| 165 } |
| 166 |
167 DOMMatrix* DOMMatrix::rotateAxisAngleSelf(double x, | 167 DOMMatrix* DOMMatrix::rotateAxisAngleSelf(double x, |
168 double y, | 168 double y, |
169 double z, | 169 double z, |
170 double angle) { | 170 double angle) { |
171 m_matrix->rotate3d(x, y, z, angle); | 171 m_matrix->rotate3d(x, y, z, angle); |
172 | 172 |
173 if (x != 0 || y != 0) | 173 if (x != 0 || y != 0) |
174 m_is2D = false; | 174 m_is2D = false; |
175 | 175 |
176 return this; | 176 return this; |
(...skipping 28 matching lines...) Expand all Loading... |
205 setM41(NAN); | 205 setM41(NAN); |
206 setM42(NAN); | 206 setM42(NAN); |
207 setM43(NAN); | 207 setM43(NAN); |
208 setM44(NAN); | 208 setM44(NAN); |
209 setIs2D(false); | 209 setIs2D(false); |
210 } | 210 } |
211 return this; | 211 return this; |
212 } | 212 } |
213 | 213 |
214 } // namespace blink | 214 } // namespace blink |
OLD | NEW |