OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DOMMatrixReadOnly_h | 5 #ifndef DOMMatrixReadOnly_h |
6 #define DOMMatrixReadOnly_h | 6 #define DOMMatrixReadOnly_h |
7 | 7 |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "core/dom/DOMTypedArray.h" | 10 #include "core/dom/DOMTypedArray.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 #include "platform/transforms/TransformationMatrix.h" | 12 #include "platform/transforms/TransformationMatrix.h" |
13 #include <memory> | 13 #include <memory> |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class DOMMatrix; | 17 class DOMMatrix; |
18 | 18 |
19 class DOMMatrixReadOnly : public GarbageCollectedFinalized<DOMMatrixReadOnly>, p
ublic ScriptWrappable { | 19 class DOMMatrixReadOnly : public GarbageCollectedFinalized<DOMMatrixReadOnly>, p
ublic ScriptWrappable { |
20 DEFINE_WRAPPERTYPEINFO(); | 20 DEFINE_WRAPPERTYPEINFO(); |
21 public: | 21 public: |
22 static DOMMatrixReadOnly* create(Vector<double>, ExceptionState&); | 22 static DOMMatrixReadOnly* create(Vector<double>, ExceptionState&); |
| 23 static DOMMatrixReadOnly* fromFloat32Array(DOMFloat32Array*, ExceptionState&
); |
| 24 static DOMMatrixReadOnly* fromFloat64Array(DOMFloat64Array*, ExceptionState&
); |
| 25 |
23 virtual ~DOMMatrixReadOnly(); | 26 virtual ~DOMMatrixReadOnly(); |
24 | 27 |
25 double a() const { return m_matrix->m11(); } | 28 double a() const { return m_matrix->m11(); } |
26 double b() const { return m_matrix->m12(); } | 29 double b() const { return m_matrix->m12(); } |
27 double c() const { return m_matrix->m21(); } | 30 double c() const { return m_matrix->m21(); } |
28 double d() const { return m_matrix->m22(); } | 31 double d() const { return m_matrix->m22(); } |
29 double e() const { return m_matrix->m41(); } | 32 double e() const { return m_matrix->m41(); } |
30 double f() const { return m_matrix->m42(); } | 33 double f() const { return m_matrix->m42(); } |
31 | 34 |
32 double m11() const { return m_matrix->m11(); } | 35 double m11() const { return m_matrix->m11(); } |
(...skipping 32 matching lines...) Loading... |
65 DOMFloat64Array* toFloat64Array() const; | 68 DOMFloat64Array* toFloat64Array() const; |
66 | 69 |
67 const String toString() const; | 70 const String toString() const; |
68 | 71 |
69 const TransformationMatrix& matrix() const { return *m_matrix; } | 72 const TransformationMatrix& matrix() const { return *m_matrix; } |
70 | 73 |
71 DEFINE_INLINE_TRACE() { } | 74 DEFINE_INLINE_TRACE() { } |
72 | 75 |
73 protected: | 76 protected: |
74 DOMMatrixReadOnly() {} | 77 DOMMatrixReadOnly() {} |
| 78 template <typename T> |
| 79 DOMMatrixReadOnly(T sequence, int size); |
75 // TransformationMatrix needs to be 16-byte aligned. PartitionAlloc | 80 // TransformationMatrix needs to be 16-byte aligned. PartitionAlloc |
76 // supports 16-byte alignment but Oilpan doesn't. So we use an std::unique_p
tr | 81 // supports 16-byte alignment but Oilpan doesn't. So we use an std::unique_p
tr |
77 // to allocate TransformationMatrix on PartitionAlloc. | 82 // to allocate TransformationMatrix on PartitionAlloc. |
78 // TODO(oilpan): Oilpan should support 16-byte aligned allocations. | 83 // TODO(oilpan): Oilpan should support 16-byte aligned allocations. |
79 std::unique_ptr<TransformationMatrix> m_matrix; | 84 std::unique_ptr<TransformationMatrix> m_matrix; |
80 bool m_is2D; | 85 bool m_is2D; |
81 | |
82 private: | |
83 DOMMatrixReadOnly(Vector<double> sequence); | |
84 }; | 86 }; |
85 | 87 |
86 } // namespace blink | 88 } // namespace blink |
87 | 89 |
88 #endif | 90 #endif |
OLD | NEW |