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

Unified Diff: Source/core/dom/DOMMatrix.cpp

Issue 426063007: Implement basic interfaces and attributes for DOMMatrix. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months 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: Source/core/dom/DOMMatrix.cpp
diff --git a/Source/core/dom/DOMMatrix.cpp b/Source/core/dom/DOMMatrix.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8a120ca2090f559ed9f9bde44b380c243984a445
--- /dev/null
+++ b/Source/core/dom/DOMMatrix.cpp
@@ -0,0 +1,46 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/dom/DOMMatrix.h"
+
+namespace blink {
+
+DOMMatrix* DOMMatrix::create()
+{
+ return new DOMMatrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
+}
+
+DOMMatrix* DOMMatrix::create(DOMMatrixReadOnly* other)
+{
+ return new DOMMatrix(other->m11(), other->m12(), other->m13(), other->m14(),
+ other->m21(), other->m22(), other->m23(), other->m24(),
+ other->m31(), other->m32(), other->m33(), other->m34(),
+ other->m41(), other->m42(), other->m43(), other->m44());
+}
+
+DOMMatrix::DOMMatrix(double m11, double m12, double m13, double m14,
+ double m21, double m22, double m23, double m24,
+ double m31, double m32, double m33, double m34,
+ double m41, double m42, double m43, double m44)
+{
+ m_matrix[0][0] = m11;
+ m_matrix[0][1] = m12;
+ m_matrix[0][2] = m13;
+ m_matrix[0][3] = m14;
+ m_matrix[1][0] = m21;
+ m_matrix[1][1] = m22;
+ m_matrix[1][2] = m23;
+ m_matrix[1][3] = m24;
+ m_matrix[2][0] = m31;
+ m_matrix[2][1] = m32;
+ m_matrix[2][2] = m33;
+ m_matrix[2][3] = m34;
+ m_matrix[3][0] = m41;
+ m_matrix[3][1] = m42;
+ m_matrix[3][2] = m43;
+ m_matrix[3][3] = m44;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698