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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 159 } |
160 virtual int externallyAllocatedBytesPerPixel() { | 160 virtual int externallyAllocatedBytesPerPixel() { |
161 NOTREACHED(); | 161 NOTREACHED(); |
162 return 0; | 162 return 0; |
163 } | 163 } |
164 | 164 |
165 // ImageBitmap-specific interface | 165 // ImageBitmap-specific interface |
166 virtual bool paint(GraphicsContext&, const IntRect&) { return false; } | 166 virtual bool paint(GraphicsContext&, const IntRect&) { return false; } |
167 | 167 |
168 // OffscreenCanvas-specific methods | 168 // OffscreenCanvas-specific methods |
169 OffscreenCanvas* getOffscreenCanvas() const { return m_offscreenCanvas; } | 169 OffscreenCanvas* offscreenCanvas() const { return m_offscreenCanvas; } |
170 virtual ImageBitmap* transferToImageBitmap(ScriptState*) { return nullptr; } | 170 virtual ImageBitmap* transferToImageBitmap(ScriptState*) { return nullptr; } |
171 | 171 |
172 bool wouldTaintOrigin(CanvasImageSource*, SecurityOrigin* = nullptr); | 172 bool wouldTaintOrigin(CanvasImageSource*, SecurityOrigin* = nullptr); |
173 void didMoveToNewDocument(Document*); | 173 void didMoveToNewDocument(Document*); |
174 | 174 |
175 void detachCanvas() { m_canvas = nullptr; } | 175 void detachCanvas() { m_canvas = nullptr; } |
| 176 void detachOffscreenCanvas() { m_offscreenCanvas = nullptr; } |
176 | 177 |
177 const CanvasContextCreationAttributes& creationAttributes() const { | 178 const CanvasContextCreationAttributes& creationAttributes() const { |
178 return m_creationAttributes; | 179 return m_creationAttributes; |
179 } | 180 } |
180 | 181 |
181 protected: | 182 protected: |
182 CanvasRenderingContext(HTMLCanvasElement*, | 183 CanvasRenderingContext(HTMLCanvasElement*, |
183 OffscreenCanvas*, | 184 OffscreenCanvas*, |
184 const CanvasContextCreationAttributes&); | 185 const CanvasContextCreationAttributes&); |
185 DECLARE_VIRTUAL_TRACE(); | 186 DECLARE_VIRTUAL_TRACE(); |
186 virtual void stop() = 0; | 187 virtual void stop() = 0; |
187 | 188 |
188 private: | 189 private: |
189 void dispose(); | 190 void dispose(); |
190 | 191 |
191 Member<HTMLCanvasElement> m_canvas; | 192 Member<HTMLCanvasElement> m_canvas; |
192 Member<OffscreenCanvas> m_offscreenCanvas; | 193 Member<OffscreenCanvas> m_offscreenCanvas; |
193 HashSet<String> m_cleanURLs; | 194 HashSet<String> m_cleanURLs; |
194 HashSet<String> m_dirtyURLs; | 195 HashSet<String> m_dirtyURLs; |
195 CanvasColorSpace m_colorSpace; | 196 CanvasColorSpace m_colorSpace; |
196 CanvasContextCreationAttributes m_creationAttributes; | 197 CanvasContextCreationAttributes m_creationAttributes; |
197 }; | 198 }; |
198 | 199 |
199 } // namespace blink | 200 } // namespace blink |
200 | 201 |
201 #endif | 202 #endif |
OLD | NEW |