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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #ifndef HTMLCanvasElement_h | 28 #ifndef HTMLCanvasElement_h |
29 #define HTMLCanvasElement_h | 29 #define HTMLCanvasElement_h |
30 | 30 |
31 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
32 #include "core/html/HTMLElement.h" | 32 #include "core/html/HTMLElement.h" |
33 #include "core/html/canvas/CanvasImageSource.h" | 33 #include "core/html/canvas/CanvasImageSource.h" |
34 #include "platform/geometry/FloatRect.h" | 34 #include "platform/geometry/FloatRect.h" |
35 #include "platform/geometry/IntSize.h" | 35 #include "platform/geometry/IntSize.h" |
36 #include "platform/graphics/GraphicsTypes.h" | 36 #include "platform/graphics/GraphicsTypes.h" |
| 37 #include "platform/graphics/GraphicsTypes3D.h" |
37 #include "platform/graphics/ImageBufferClient.h" | 38 #include "platform/graphics/ImageBufferClient.h" |
38 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
39 #include "public/platform/WebThread.h" | 40 #include "public/platform/WebThread.h" |
40 #include "wtf/Forward.h" | |
41 | 41 |
42 #define CanvasDefaultInterpolationQuality InterpolationLow | 42 #define CanvasDefaultInterpolationQuality InterpolationLow |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 class AffineTransform; | 46 class AffineTransform; |
47 class CanvasContextAttributes; | 47 class CanvasContextAttributes; |
48 class CanvasRenderingContext; | 48 class CanvasRenderingContext; |
49 class GraphicsContext; | 49 class GraphicsContext; |
50 class GraphicsContextStateSaver; | 50 class GraphicsContextStateSaver; |
(...skipping 61 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 Image* copiedImage(SourceDrawingBuffer) const; |
123 void clearCopiedImage(); | 123 void clearCopiedImage(); |
124 PassRefPtrWillBeRawPtr<ImageData> getImageData() const; | |
125 | 124 |
126 SecurityOrigin* securityOrigin() const; | 125 SecurityOrigin* securityOrigin() const; |
127 bool originClean() const { return m_originClean; } | 126 bool originClean() const { return m_originClean; } |
128 void setOriginTainted() { m_originClean = false; } | 127 void setOriginTainted() { m_originClean = false; } |
129 | 128 |
130 AffineTransform baseTransform() const; | 129 AffineTransform baseTransform() const; |
131 | 130 |
132 bool is3D() const; | 131 bool is3D() const; |
133 | 132 |
134 bool hasImageBuffer() const { return m_imageBuffer; } | 133 bool hasImageBuffer() const { return m_imageBuffer; } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 bool shouldUseDisplayList(const IntSize& deviceSize); | 179 bool shouldUseDisplayList(const IntSize& deviceSize); |
181 | 180 |
182 void resetDirtyRect(); | 181 void resetDirtyRect(); |
183 | 182 |
184 void setSurfaceSize(const IntSize&); | 183 void setSurfaceSize(const IntSize&); |
185 | 184 |
186 bool paintsIntoCanvasBuffer() const; | 185 bool paintsIntoCanvasBuffer() const; |
187 | 186 |
188 void updateExternallyAllocatedMemory() const; | 187 void updateExternallyAllocatedMemory() const; |
189 | 188 |
190 String toDataURLInternal(const String& mimeType, const double* quality, bool
isSaving = false) const; | 189 String toDataURLInternal(const String& mimeType, const double* quality, Sour
ceDrawingBuffer) const; |
191 | 190 |
192 WillBeHeapHashSet<RawPtrWillBeWeakMember<CanvasObserver>> m_observers; | 191 WillBeHeapHashSet<RawPtrWillBeWeakMember<CanvasObserver>> m_observers; |
193 | 192 |
194 IntSize m_size; | 193 IntSize m_size; |
195 | 194 |
196 OwnPtrWillBeMember<CanvasRenderingContext> m_context; | 195 OwnPtrWillBeMember<CanvasRenderingContext> m_context; |
197 | 196 |
198 bool m_ignoreReset; | 197 bool m_ignoreReset; |
199 bool m_accelerationDisabled; | 198 bool m_accelerationDisabled; |
200 FloatRect m_dirtyRect; | 199 FloatRect m_dirtyRect; |
201 | 200 |
202 mutable intptr_t m_externallyAllocatedMemory; | 201 mutable intptr_t m_externallyAllocatedMemory; |
203 | 202 |
204 bool m_originClean; | 203 bool m_originClean; |
205 | 204 |
206 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t
o allocate an imageBuffer | 205 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t
o allocate an imageBuffer |
207 // after the first attempt failed. | 206 // after the first attempt failed. |
208 mutable bool m_didFailToCreateImageBuffer; | 207 mutable bool m_didFailToCreateImageBuffer; |
209 bool m_imageBufferIsClear; | 208 bool m_imageBufferIsClear; |
210 OwnPtr<ImageBuffer> m_imageBuffer; | 209 OwnPtr<ImageBuffer> m_imageBuffer; |
211 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver; | 210 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver; |
212 | 211 |
213 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). | 212 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 }; | 213 }; |
215 | 214 |
216 } // namespace blink | 215 } // namespace blink |
217 | 216 |
218 #endif // HTMLCanvasElement_h | 217 #endif // HTMLCanvasElement_h |
OLD | NEW |