| 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::skewXSelf(double sx) { | 167 DOMMatrix* DOMMatrix::skewXSelf(double sx) { |
| 168 m_matrix->skewX(sx); | 168 m_matrix->skewX(sx); |
| 169 return this; | 169 return this; |
| 170 } | 170 } |
| 171 | 171 |
| 172 DOMMatrix* DOMMatrix::skewYSelf(double sy) { | 172 DOMMatrix* DOMMatrix::skewYSelf(double sy) { |
| 173 m_matrix->skewY(sy); | 173 m_matrix->skewY(sy); |
| 174 return this; | 174 return this; |
| 175 } | 175 } |
| 176 | 176 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 193 setM41(NAN); | 193 setM41(NAN); |
| 194 setM42(NAN); | 194 setM42(NAN); |
| 195 setM43(NAN); | 195 setM43(NAN); |
| 196 setM44(NAN); | 196 setM44(NAN); |
| 197 setIs2D(false); | 197 setIs2D(false); |
| 198 } | 198 } |
| 199 return this; | 199 return this; |
| 200 } | 200 } |
| 201 | 201 |
| 202 } // namespace blink | 202 } // namespace blink |
| OLD | NEW |