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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 void paint(GraphicsContext*, const LayoutRect&); | 113 void paint(GraphicsContext*, const LayoutRect&); |
114 | 114 |
115 GraphicsContext* drawingContext() const; | 115 GraphicsContext* drawingContext() const; |
116 GraphicsContext* existingDrawingContext() const; | 116 GraphicsContext* existingDrawingContext() const; |
117 | 117 |
118 CanvasRenderingContext* renderingContext() const { return m_context.get(); } | 118 CanvasRenderingContext* renderingContext() const { return m_context.get(); } |
119 | 119 |
120 void ensureUnacceleratedImageBuffer(); | 120 void ensureUnacceleratedImageBuffer(); |
121 ImageBuffer* buffer() const; | 121 ImageBuffer* buffer() const; |
122 Image* copiedImage() const; | 122 enum SourceBuffer { Front, Back }; |
| 123 Image* copiedImage(SourceBuffer) const; |
123 void clearCopiedImage(); | 124 void clearCopiedImage(); |
124 PassRefPtrWillBeRawPtr<ImageData> getImageData() const; | |
125 | 125 |
126 SecurityOrigin* securityOrigin() const; | 126 SecurityOrigin* securityOrigin() const; |
127 bool originClean() const { return m_originClean; } | 127 bool originClean() const { return m_originClean; } |
128 void setOriginTainted() { m_originClean = false; } | 128 void setOriginTainted() { m_originClean = false; } |
129 | 129 |
130 AffineTransform baseTransform() const; | 130 AffineTransform baseTransform() const; |
131 | 131 |
132 bool is3D() const; | 132 bool is3D() const; |
133 | 133 |
134 bool hasImageBuffer() const { return m_imageBuffer; } | 134 bool hasImageBuffer() const { return m_imageBuffer; } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 bool shouldUseDisplayList(const IntSize& deviceSize); | 181 bool shouldUseDisplayList(const IntSize& deviceSize); |
182 | 182 |
183 void resetDirtyRect(); | 183 void resetDirtyRect(); |
184 | 184 |
185 void setSurfaceSize(const IntSize&); | 185 void setSurfaceSize(const IntSize&); |
186 | 186 |
187 bool paintsIntoCanvasBuffer() const; | 187 bool paintsIntoCanvasBuffer() const; |
188 | 188 |
189 void updateExternallyAllocatedMemory() const; | 189 void updateExternallyAllocatedMemory() const; |
190 | 190 |
191 String toDataURLInternal(const String& mimeType, const double* quality, bool
isSaving = false) const; | 191 String toDataURLInternal(const String& mimeType, const double* quality, Sour
ceBuffer) const; |
192 | 192 |
193 WillBeHeapHashSet<RawPtrWillBeWeakMember<CanvasObserver>> m_observers; | 193 WillBeHeapHashSet<RawPtrWillBeWeakMember<CanvasObserver>> m_observers; |
194 | 194 |
195 IntSize m_size; | 195 IntSize m_size; |
196 | 196 |
197 OwnPtrWillBeMember<CanvasRenderingContext> m_context; | 197 OwnPtrWillBeMember<CanvasRenderingContext> m_context; |
198 | 198 |
199 bool m_ignoreReset; | 199 bool m_ignoreReset; |
200 bool m_accelerationDisabled; | 200 bool m_accelerationDisabled; |
201 FloatRect m_dirtyRect; | 201 FloatRect m_dirtyRect; |
202 | 202 |
203 mutable intptr_t m_externallyAllocatedMemory; | 203 mutable intptr_t m_externallyAllocatedMemory; |
204 | 204 |
205 bool m_originClean; | 205 bool m_originClean; |
206 | 206 |
207 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t
o allocate an imageBuffer | 207 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t
o allocate an imageBuffer |
208 // after the first attempt failed. | 208 // after the first attempt failed. |
209 mutable bool m_didFailToCreateImageBuffer; | 209 mutable bool m_didFailToCreateImageBuffer; |
210 mutable bool m_didClearImageBuffer; | 210 mutable bool m_didClearImageBuffer; |
211 OwnPtr<ImageBuffer> m_imageBuffer; | 211 OwnPtr<ImageBuffer> m_imageBuffer; |
212 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver; | 212 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver; |
213 | 213 |
214 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). | 214 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). |
215 }; | 215 }; |
216 | 216 |
217 } // namespace blink | 217 } // namespace blink |
218 | 218 |
219 #endif // HTMLCanvasElement_h | 219 #endif // HTMLCanvasElement_h |
OLD | NEW |