Index: Source/core/dom/DOMMatrix.cpp |
diff --git a/Source/core/dom/DOMMatrix.cpp b/Source/core/dom/DOMMatrix.cpp |
index 59b27ccf9fcece18644f4a4e4be5a3b4d25115a4..f56869a57dc6ec4f0b49e2785374fdc19e261125 100644 |
--- a/Source/core/dom/DOMMatrix.cpp |
+++ b/Source/core/dom/DOMMatrix.cpp |
@@ -52,4 +52,59 @@ void DOMMatrix::setIs2D(bool value) |
m_is2D = value; |
} |
+DOMMatrix* DOMMatrix::scaleSelf(double scale, double ox, double oy) |
+{ |
+ return scaleNonUniformSelf(scale, scale, 1, ox, oy); |
+} |
+ |
+DOMMatrix* DOMMatrix::scale3dSelf(double scale, double ox, double oy, double oz) |
+{ |
+ return scaleNonUniformSelf(scale, scale, scale, ox, oy, oz); |
+} |
+ |
+DOMMatrix* DOMMatrix::scaleNonUniformSelf(double sx, double sy, double sz, |
+ double ox, double oy, double oz) |
+{ |
+ if (sz != 1 || oz) |
+ m_is2D = false; |
+ |
+ if (sx == 1 && sy == 1 && sz == 1) |
+ return this; |
+ |
+ bool hasTranslation = (ox || oy || oz); |
+ |
+ if (hasTranslation) |
+ translateSelf(ox, oy, oz); |
+ |
+ if (isIdentity()) { |
krit
2014/08/08 05:47:34
Why not implement this in TransformationMatrix?
zino
2014/08/17 11:35:25
Done.
|
+ m_matrix[0][0] = sx; |
+ m_matrix[1][1] = sy; |
+ m_matrix[2][2] = sz; |
+ } else { |
+ if (sx != 1) { |
+ m_matrix[0][0] *= sx; |
+ m_matrix[0][1] *= sx; |
+ m_matrix[0][2] *= sx; |
+ m_matrix[0][3] *= sx; |
+ } |
+ if (sy != 1) { |
+ m_matrix[1][0] *= sy; |
+ m_matrix[1][1] *= sy; |
+ m_matrix[1][2] *= sy; |
+ m_matrix[1][3] *= sy; |
+ } |
+ if (sz != 1) { |
+ m_matrix[2][0] *= sz; |
+ m_matrix[2][1] *= sz; |
+ m_matrix[2][2] *= sz; |
+ m_matrix[2][3] *= sz; |
+ } |
+ } |
+ |
+ if (hasTranslation) |
+ translateSelf(-ox, -oy, -oz); |
+ |
+ return this; |
+} |
+ |
} // namespace blink |