OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // Used for canvas capture. | 107 // Used for canvas capture. |
108 void addListener(CanvasDrawListener*); | 108 void addListener(CanvasDrawListener*); |
109 void removeListener(CanvasDrawListener*); | 109 void removeListener(CanvasDrawListener*); |
110 | 110 |
111 // Used for rendering | 111 // Used for rendering |
112 void didDraw(const FloatRect&); | 112 void didDraw(const FloatRect&); |
113 | 113 |
114 void paint(GraphicsContext&, const LayoutRect&); | 114 void paint(GraphicsContext&, const LayoutRect&); |
115 | 115 |
116 SkCanvas* drawingCanvas() const; | 116 SkCanvas* drawingCanvas() const; |
117 void disableDeferral() const; | 117 void disableDeferral(DisableDeferralReason) const; |
118 SkCanvas* existingDrawingCanvas() const; | 118 SkCanvas* existingDrawingCanvas() const; |
119 | 119 |
120 void setRenderingContext(PassOwnPtrWillBeRawPtr<CanvasRenderingContext>); | 120 void setRenderingContext(PassOwnPtrWillBeRawPtr<CanvasRenderingContext>); |
121 CanvasRenderingContext* renderingContext() const { return m_context.get(); } | 121 CanvasRenderingContext* renderingContext() const { return m_context.get(); } |
122 | 122 |
123 void ensureUnacceleratedImageBuffer(); | 123 void ensureUnacceleratedImageBuffer(); |
124 ImageBuffer* buffer() const; | 124 ImageBuffer* buffer() const; |
125 PassRefPtr<Image> copiedImage(SourceDrawingBuffer, AccelerationHint) const; | 125 PassRefPtr<Image> copiedImage(SourceDrawingBuffer, AccelerationHint) const; |
126 void clearCopiedImage(); | 126 void clearCopiedImage(); |
127 | 127 |
(...skipping 17 matching lines...) Expand all Loading... |
145 | 145 |
146 const AtomicString imageSourceURL() const override; | 146 const AtomicString imageSourceURL() const override; |
147 | 147 |
148 InsertionNotificationRequest insertedInto(ContainerNode*) override; | 148 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
149 | 149 |
150 // DocumentVisibilityObserver implementation | 150 // DocumentVisibilityObserver implementation |
151 void didChangeVisibilityState(PageVisibilityState) override; | 151 void didChangeVisibilityState(PageVisibilityState) override; |
152 void willDetachDocument() override; | 152 void willDetachDocument() override; |
153 | 153 |
154 // CanvasImageSource implementation | 154 // CanvasImageSource implementation |
155 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt) const override; | 155 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt, SnapshotReason) const override; |
156 bool wouldTaintOrigin(SecurityOrigin*) const override; | 156 bool wouldTaintOrigin(SecurityOrigin*) const override; |
157 FloatSize elementSize() const override; | 157 FloatSize elementSize() const override; |
158 bool isCanvasElement() const override { return true; } | 158 bool isCanvasElement() const override { return true; } |
159 bool isOpaque() const override; | 159 bool isOpaque() const override; |
160 | 160 |
161 // ImageBufferClient implementation | 161 // ImageBufferClient implementation |
162 void notifySurfaceInvalid() override; | 162 void notifySurfaceInvalid() override; |
163 bool isDirty() override { return !m_dirtyRect.isEmpty(); } | 163 bool isDirty() override { return !m_dirtyRect.isEmpty(); } |
164 void didFinalizeFrame() override; | 164 void didFinalizeFrame() override; |
165 void restoreCanvasMatrixClipStack(SkCanvas*) const override; | 165 void restoreCanvasMatrixClipStack(SkCanvas*) const override; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& devic
eSize, int* msaaSampleCount); | 201 PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& devic
eSize, int* msaaSampleCount); |
202 void createImageBuffer(); | 202 void createImageBuffer(); |
203 void createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurfac
e); | 203 void createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurfac
e); |
204 bool shouldUseDisplayList(const IntSize& deviceSize); | 204 bool shouldUseDisplayList(const IntSize& deviceSize); |
205 | 205 |
206 void setSurfaceSize(const IntSize&); | 206 void setSurfaceSize(const IntSize&); |
207 | 207 |
208 bool paintsIntoCanvasBuffer() const; | 208 bool paintsIntoCanvasBuffer() const; |
209 | 209 |
210 ImageData* toImageData(SourceDrawingBuffer) const; | 210 ImageData* toImageData(SourceDrawingBuffer, SnapshotReason) const; |
| 211 |
211 String toDataURLInternal(const String& mimeType, const double& quality, Sour
ceDrawingBuffer) const; | 212 String toDataURLInternal(const String& mimeType, const double& quality, Sour
ceDrawingBuffer) const; |
212 | 213 |
213 PersistentHeapHashSetWillBeHeapHashSet<WeakMember<CanvasDrawListener>> m_lis
teners; | 214 PersistentHeapHashSetWillBeHeapHashSet<WeakMember<CanvasDrawListener>> m_lis
teners; |
214 | 215 |
215 IntSize m_size; | 216 IntSize m_size; |
216 | 217 |
217 OwnPtrWillBeMember<CanvasRenderingContext> m_context; | 218 OwnPtrWillBeMember<CanvasRenderingContext> m_context; |
218 | 219 |
219 bool m_ignoreReset; | 220 bool m_ignoreReset; |
220 FloatRect m_dirtyRect; | 221 FloatRect m_dirtyRect; |
221 | 222 |
222 mutable intptr_t m_externallyAllocatedMemory; | 223 mutable intptr_t m_externallyAllocatedMemory; |
223 | 224 |
224 bool m_originClean; | 225 bool m_originClean; |
225 | 226 |
226 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t
o allocate an imageBuffer | 227 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t
o allocate an imageBuffer |
227 // after the first attempt failed. | 228 // after the first attempt failed. |
228 mutable bool m_didFailToCreateImageBuffer; | 229 mutable bool m_didFailToCreateImageBuffer; |
229 bool m_imageBufferIsClear; | 230 bool m_imageBufferIsClear; |
230 OwnPtr<ImageBuffer> m_imageBuffer; | 231 OwnPtr<ImageBuffer> m_imageBuffer; |
231 | 232 |
232 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). | 233 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). |
233 }; | 234 }; |
234 | 235 |
235 } // namespace blink | 236 } // namespace blink |
236 | 237 |
237 #endif // HTMLCanvasElement_h | 238 #endif // HTMLCanvasElement_h |
OLD | NEW |