Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Unified Diff: third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp

Issue 2423753002: [GeometryInterface] add transformPoint(point) function. (Closed)
Patch Set: [GeometryInterface] add transformPoint(point) method. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 1922a50b0872e2c1c044a280031071651191fa5a..6bccffcb1f07552bce05e239d618af6720367660 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 {
@@ -226,6 +228,24 @@ DOMMatrix* DOMMatrixReadOnly::inverse() {
return DOMMatrix::create(this)->invertSelf();
}
+DOMPoint* DOMMatrixReadOnly::transformPoint(const DOMPointInit& point) {
dominicc (has gone to gerrit) 2016/11/08 08:55:34 I'm curious but what's the efficiency in our bindi
Hwanseung Lee 2016/11/13 02:47:10 i think it is almost same. DOMPointInit have all a
+ 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()),

Powered by Google App Engine
This is Rietveld 408576698