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 b0a49af8abac3ee38fd3451ed6d6656ba891a2fe..0b34d8bf78ff3d29f3704b555fc54322095281db 100644 |
--- a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp |
+++ b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp |
@@ -7,6 +7,8 @@ |
#include "bindings/core/v8/V8ObjectBuilder.h" |
#include "core/dom/DOMMatrix.h" |
#include "core/dom/DOMMatrixInit.h" |
+#include "core/dom/DOMPoint.h" |
+#include "core/dom/DOMPointInit.h" |
namespace blink { |
namespace { |
@@ -229,6 +231,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()), |