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