Chromium Code Reviews| Index: Source/core/dom/DOMMatrix.cpp |
| diff --git a/Source/core/dom/DOMMatrix.cpp b/Source/core/dom/DOMMatrix.cpp |
| index 59b27ccf9fcece18644f4a4e4be5a3b4d25115a4..e1fe9ae0ba05ee0838cccfd49e1ce0319bafdd8b 100644 |
| --- a/Source/core/dom/DOMMatrix.cpp |
| +++ b/Source/core/dom/DOMMatrix.cpp |
| @@ -52,4 +52,31 @@ void DOMMatrix::setIs2D(bool value) |
| m_is2D = value; |
| } |
| +DOMMatrix* DOMMatrix::translateSelf(double tx, double ty, double tz) |
| +{ |
| + if (!tx && !ty && !tz) |
| + return this; |
| + |
| + if (tz) |
| + m_is2D = false; |
| + |
| + if (isIdentity()) { |
|
krit
2014/08/08 06:24:15
Why don't you use TransformationMatrix here?
zino
2014/08/16 03:23:32
Done.
|
| + m_matrix[3][0] = tx; |
| + m_matrix[3][1] = ty; |
| + m_matrix[3][2] = tz; |
| + } else { |
| + m_matrix[3][0] += tx * m11() + ty * m21(); |
| + m_matrix[3][1] += tx * m12() + ty * m22(); |
| + |
| + if (!m_is2D) { |
| + m_matrix[3][0] += tz * m31(); |
| + m_matrix[3][1] += tz * m32(); |
| + m_matrix[3][2] += tx * m13() + ty * m23() + tz * m33(); |
| + m_matrix[3][3] += tx * m14() + ty * m24() + tz * m34(); |
| + } |
| + } |
| + |
| + return this; |
| +} |
| + |
| } // namespace blink |