OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 OffscreenCanvas_h | 5 #ifndef OffscreenCanvas_h |
6 #define OffscreenCanvas_h | 6 #define OffscreenCanvas_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
11 #include "core/CoreExport.h" | 11 #include "core/CoreExport.h" |
12 #include "platform/geometry/IntSize.h" | 12 #include "platform/geometry/IntSize.h" |
13 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class CanvasContextCreationAttributes; | |
Justin Novosad
2016/03/02 15:41:50
The Blink core has no dependency on OffscreenCanva
| |
18 class OffscreenCanvasRenderingContext; | |
19 class OffscreenCanvasRenderingContextFactory; | |
20 | |
17 class CORE_EXPORT OffscreenCanvas final : public GarbageCollectedFinalized<Offsc reenCanvas>, public ScriptWrappable { | 21 class CORE_EXPORT OffscreenCanvas final : public GarbageCollectedFinalized<Offsc reenCanvas>, public ScriptWrappable { |
18 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
19 public: | 23 public: |
20 static OffscreenCanvas* create(unsigned width, unsigned height); | 24 static OffscreenCanvas* create(unsigned width, unsigned height); |
21 | 25 |
22 IntSize size() const { return m_size; } | 26 IntSize size() const { return m_size; } |
23 unsigned width() const { return m_size.width(); } | 27 unsigned width() const { return m_size.width(); } |
24 unsigned height() const { return m_size.height(); } | 28 unsigned height() const { return m_size.height(); } |
25 | |
26 void setWidth(unsigned); | 29 void setWidth(unsigned); |
27 void setHeight(unsigned); | 30 void setHeight(unsigned); |
28 | 31 |
32 OffscreenCanvasRenderingContext* getContext(const String&, const CanvasConte xtCreationAttributes&); | |
33 OffscreenCanvasRenderingContext* renderingContext() const { return m_context .get(); } | |
34 | |
35 static void registerRenderingContextFactory(PassOwnPtr<OffscreenCanvasRender ingContextFactory>); | |
36 | |
29 DECLARE_VIRTUAL_TRACE(); | 37 DECLARE_VIRTUAL_TRACE(); |
30 | 38 |
31 private: | 39 private: |
32 OffscreenCanvas(const IntSize&); | 40 OffscreenCanvas(const IntSize&); |
33 | 41 |
42 using ContextFactoryVector = Vector<OwnPtr<OffscreenCanvasRenderingContextFa ctory>>; | |
43 static ContextFactoryVector& renderingContextFactories(); | |
44 static OffscreenCanvasRenderingContextFactory* getRenderingContextFactory(in t); | |
45 | |
46 OwnPtrWillBeMember<OffscreenCanvasRenderingContext> m_context; | |
34 IntSize m_size; | 47 IntSize m_size; |
35 }; | 48 }; |
36 | 49 |
37 } // namespace blink | 50 } // namespace blink |
38 | 51 |
39 #endif // OffscreenCanvas_h | 52 #endif // OffscreenCanvas_h |
OLD | NEW |