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 <memory> | 8 #include <memory> |
9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
11 #include "core/dom/DOMTypedArray.h" | 11 #include "core/dom/DOMTypedArray.h" |
12 #include "core/dom/NotShared.h" | |
13 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
14 #include "platform/transforms/TransformationMatrix.h" | 13 #include "platform/transforms/TransformationMatrix.h" |
15 | 14 |
16 namespace blink { | 15 namespace blink { |
17 | 16 |
18 class DOMMatrix; | 17 class DOMMatrix; |
19 class DOMMatrixInit; | 18 class DOMMatrixInit; |
20 class DOMPoint; | 19 class DOMPoint; |
21 class DOMPointInit; | 20 class DOMPointInit; |
22 | 21 |
23 class CORE_EXPORT DOMMatrixReadOnly | 22 class CORE_EXPORT DOMMatrixReadOnly |
24 : public GarbageCollectedFinalized<DOMMatrixReadOnly>, | 23 : public GarbageCollectedFinalized<DOMMatrixReadOnly>, |
25 public ScriptWrappable { | 24 public ScriptWrappable { |
26 DEFINE_WRAPPERTYPEINFO(); | 25 DEFINE_WRAPPERTYPEINFO(); |
27 | 26 |
28 public: | 27 public: |
29 static DOMMatrixReadOnly* Create(ExceptionState&); | 28 static DOMMatrixReadOnly* Create(ExceptionState&); |
30 static DOMMatrixReadOnly* Create(const String&, ExceptionState&); | 29 static DOMMatrixReadOnly* Create(const String&, ExceptionState&); |
31 static DOMMatrixReadOnly* Create(Vector<double>, ExceptionState&); | 30 static DOMMatrixReadOnly* Create(Vector<double>, ExceptionState&); |
32 static DOMMatrixReadOnly* fromFloat32Array(NotShared<DOMFloat32Array>, | 31 static DOMMatrixReadOnly* fromFloat32Array(DOMFloat32Array*, ExceptionState&); |
33 ExceptionState&); | 32 static DOMMatrixReadOnly* fromFloat64Array(DOMFloat64Array*, ExceptionState&); |
34 static DOMMatrixReadOnly* fromFloat64Array(NotShared<DOMFloat64Array>, | |
35 ExceptionState&); | |
36 static DOMMatrixReadOnly* fromMatrix(DOMMatrixInit&, ExceptionState&); | 33 static DOMMatrixReadOnly* fromMatrix(DOMMatrixInit&, ExceptionState&); |
37 virtual ~DOMMatrixReadOnly(); | 34 virtual ~DOMMatrixReadOnly(); |
38 | 35 |
39 double a() const { return matrix_->M11(); } | 36 double a() const { return matrix_->M11(); } |
40 double b() const { return matrix_->M12(); } | 37 double b() const { return matrix_->M12(); } |
41 double c() const { return matrix_->M21(); } | 38 double c() const { return matrix_->M21(); } |
42 double d() const { return matrix_->M22(); } | 39 double d() const { return matrix_->M22(); } |
43 double e() const { return matrix_->M41(); } | 40 double e() const { return matrix_->M41(); } |
44 double f() const { return matrix_->M42(); } | 41 double f() const { return matrix_->M42(); } |
45 | 42 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 double z = 0, | 82 double z = 0, |
86 double angle = 0); | 83 double angle = 0); |
87 DOMMatrix* skewX(double sx); | 84 DOMMatrix* skewX(double sx); |
88 DOMMatrix* skewY(double sy); | 85 DOMMatrix* skewY(double sy); |
89 DOMMatrix* flipX(); | 86 DOMMatrix* flipX(); |
90 DOMMatrix* flipY(); | 87 DOMMatrix* flipY(); |
91 DOMMatrix* inverse(); | 88 DOMMatrix* inverse(); |
92 | 89 |
93 DOMPoint* transformPoint(const DOMPointInit&); | 90 DOMPoint* transformPoint(const DOMPointInit&); |
94 | 91 |
95 NotShared<DOMFloat32Array> toFloat32Array() const; | 92 DOMFloat32Array* toFloat32Array() const; |
96 NotShared<DOMFloat64Array> toFloat64Array() const; | 93 DOMFloat64Array* toFloat64Array() const; |
97 | 94 |
98 const String toString() const; | 95 const String toString() const; |
99 | 96 |
100 ScriptValue toJSONForBinding(ScriptState*) const; | 97 ScriptValue toJSONForBinding(ScriptState*) const; |
101 | 98 |
102 const TransformationMatrix& Matrix() const { return *matrix_; } | 99 const TransformationMatrix& Matrix() const { return *matrix_; } |
103 | 100 |
104 DEFINE_INLINE_TRACE() {} | 101 DEFINE_INLINE_TRACE() {} |
105 | 102 |
106 protected: | 103 protected: |
(...skipping 27 matching lines...) Expand all Loading... |
134 // supports 16-byte alignment but Oilpan doesn't. So we use an std::unique_ptr | 131 // supports 16-byte alignment but Oilpan doesn't. So we use an std::unique_ptr |
135 // to allocate TransformationMatrix on PartitionAlloc. | 132 // to allocate TransformationMatrix on PartitionAlloc. |
136 // TODO(oilpan): Oilpan should support 16-byte aligned allocations. | 133 // TODO(oilpan): Oilpan should support 16-byte aligned allocations. |
137 std::unique_ptr<TransformationMatrix> matrix_; | 134 std::unique_ptr<TransformationMatrix> matrix_; |
138 bool is2d_; | 135 bool is2d_; |
139 }; | 136 }; |
140 | 137 |
141 } // namespace blink | 138 } // namespace blink |
142 | 139 |
143 #endif | 140 #endif |
OLD | NEW |