OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef CanvasRenderingContext_h | 26 #ifndef CanvasRenderingContext_h |
27 #define CanvasRenderingContext_h | 27 #define CanvasRenderingContext_h |
28 | 28 |
29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
30 #include "core/html/HTMLCanvasElement.h" | 30 #include "core/html/HTMLCanvasElement.h" |
31 #include "platform/heap/Handle.h" | |
32 #include "wtf/HashSet.h" | 31 #include "wtf/HashSet.h" |
33 #include "wtf/Noncopyable.h" | 32 #include "wtf/Noncopyable.h" |
34 #include "wtf/text/StringHash.h" | 33 #include "wtf/text/StringHash.h" |
35 | 34 |
36 class SkCanvas; | 35 class SkCanvas; |
37 | 36 |
38 namespace blink { class WebLayer; } | 37 namespace blink { class WebLayer; } |
39 | 38 |
40 namespace blink { | 39 namespace blink { |
41 | 40 |
42 class CanvasImageSource; | 41 class CanvasImageSource; |
43 class HTMLCanvasElement; | 42 class HTMLCanvasElement; |
44 class ImageData; | 43 class ImageData; |
45 | 44 |
46 class CORE_EXPORT CanvasRenderingContext : public NoBaseWillBeGarbageCollectedFi
nalized<CanvasRenderingContext>, public ScriptWrappable { | 45 class CORE_EXPORT CanvasRenderingContext : public NoBaseWillBeGarbageCollectedFi
nalized<CanvasRenderingContext>, public ScriptWrappable { |
47 WTF_MAKE_NONCOPYABLE(CanvasRenderingContext); | 46 WTF_MAKE_NONCOPYABLE(CanvasRenderingContext); |
48 USING_FAST_MALLOC_WILL_BE_REMOVED(CanvasRenderingContext); | 47 USING_FAST_MALLOC_WILL_BE_REMOVED(CanvasRenderingContext); |
49 public: | 48 public: |
50 virtual ~CanvasRenderingContext() { } | 49 virtual ~CanvasRenderingContext() { } |
51 | 50 |
52 // A Canvas can either be "2D" or "webgl" but never both. If you request a 2
D canvas and the existing | 51 // A Canvas can either be "2D" or "webgl" but never both. If you request a 2
D canvas and the existing |
53 // context is already 2D, just return that. If the existing context is WebGL
, then destroy it | 52 // context is already 2D, just return that. If the existing context is WebGL
, then destroy it |
54 // before creating a new 2D context. Vice versa when requesting a WebGL canv
as. Requesting a | 53 // before creating a new 2D context. Vice versa when requesting a WebGL canv
as. Requesting a |
55 // context with any other type string will destroy any existing context. | 54 // context with any other type string will destroy any existing context. |
56 enum ContextType { | 55 enum ContextType { |
57 // Do not change assigned numbers of existing items: add new features to
the end of the list. | 56 // Do not change assigned numbers of existing items: add new features to
the end of the list. |
58 Context2d = 0, | 57 Context2d = 0, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 118 |
120 // ImageBitmap-specific interface | 119 // ImageBitmap-specific interface |
121 virtual bool paint(GraphicsContext&, const IntRect&) { return false; } | 120 virtual bool paint(GraphicsContext&, const IntRect&) { return false; } |
122 | 121 |
123 bool wouldTaintOrigin(CanvasImageSource*); | 122 bool wouldTaintOrigin(CanvasImageSource*); |
124 void didMoveToNewDocument(Document*); | 123 void didMoveToNewDocument(Document*); |
125 | 124 |
126 protected: | 125 protected: |
127 CanvasRenderingContext(HTMLCanvasElement*); | 126 CanvasRenderingContext(HTMLCanvasElement*); |
128 DECLARE_VIRTUAL_TRACE(); | 127 DECLARE_VIRTUAL_TRACE(); |
129 | |
130 virtual void stop() = 0; | 128 virtual void stop() = 0; |
131 | 129 |
132 private: | 130 private: |
133 RawPtrWillBeMember<HTMLCanvasElement> m_canvas; | 131 RawPtrWillBeMember<HTMLCanvasElement> m_canvas; |
134 HashSet<String> m_cleanURLs; | 132 HashSet<String> m_cleanURLs; |
135 HashSet<String> m_dirtyURLs; | 133 HashSet<String> m_dirtyURLs; |
136 }; | 134 }; |
137 | 135 |
138 } // namespace blink | 136 } // namespace blink |
139 | 137 |
140 #endif | 138 #endif |
OLD | NEW |