Index: third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp |
diff --git a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp |
index 7cf081eecea7c77028b720eef25e99c27d7ed05e..42a1b00320e58aba4cfd190639fcf388a0b1c8ec 100644 |
--- a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp |
+++ b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp |
@@ -4,6 +4,8 @@ |
#include "core/dom/DOMMatrix.h" |
#include "core/dom/DOMMatrixInit.h" |
+#include "core/dom/DOMPoint.h" |
+#include "core/dom/DOMPointInit.h" |
namespace blink { |
namespace { |
@@ -210,6 +212,24 @@ DOMMatrix* DOMMatrixReadOnly::inverse() { |
return DOMMatrix::create(this)->invertSelf(); |
} |
+DOMPoint* DOMMatrixReadOnly::transformPoint(const DOMPointInit& point) { |
+ if (is2D() && point.z() == 0 && point.w() == 1) { |
+ double x = point.x() * m11() + point.y() * m12() + m41(); |
+ double y = point.x() * m12() + point.y() * m22() + m42(); |
+ return DOMPoint::create(x, y, 0, 1); |
+ } |
+ |
+ double x = point.x() * m11() + point.y() * m21() + point.z() * m31() + |
+ point.w() * m41(); |
+ double y = point.x() * m12() + point.y() * m22() + point.z() * m32() + |
+ point.w() * m42(); |
+ double z = point.x() * m13() + point.y() * m23() + point.z() * m33() + |
+ point.w() * m43(); |
+ double w = point.x() * m14() + point.y() * m24() + point.z() * m34() + |
+ point.w() * m44(); |
+ return DOMPoint::create(x, y, z, w); |
+} |
+ |
DOMFloat32Array* DOMMatrixReadOnly::toFloat32Array() const { |
float array[] = { |
static_cast<float>(m_matrix->m11()), static_cast<float>(m_matrix->m12()), |