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 10 matching lines...) Expand all Loading... |
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #ifndef HTMLCanvasElement_h | 28 #ifndef HTMLCanvasElement_h |
29 #define HTMLCanvasElement_h | 29 #define HTMLCanvasElement_h |
30 | 30 |
| 31 #include "bindings/core/v8/ScriptValue.h" |
| 32 #include "bindings/core/v8/UnionTypesCore.h" |
31 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
32 #include "core/html/HTMLElement.h" | 34 #include "core/html/HTMLElement.h" |
33 #include "core/html/canvas/CanvasImageSource.h" | 35 #include "core/html/canvas/CanvasImageSource.h" |
34 #include "platform/geometry/FloatRect.h" | 36 #include "platform/geometry/FloatRect.h" |
35 #include "platform/geometry/IntSize.h" | 37 #include "platform/geometry/IntSize.h" |
36 #include "platform/graphics/GraphicsTypes.h" | 38 #include "platform/graphics/GraphicsTypes.h" |
37 #include "platform/graphics/GraphicsTypes3D.h" | 39 #include "platform/graphics/GraphicsTypes3D.h" |
38 #include "platform/graphics/ImageBufferClient.h" | 40 #include "platform/graphics/ImageBufferClient.h" |
39 #include "platform/heap/Handle.h" | 41 #include "platform/heap/Handle.h" |
40 #include "public/platform/WebThread.h" | 42 #include "public/platform/WebThread.h" |
41 | 43 |
42 #define CanvasDefaultInterpolationQuality InterpolationLow | 44 #define CanvasDefaultInterpolationQuality InterpolationLow |
43 | 45 |
44 namespace blink { | 46 namespace blink { |
45 | 47 |
46 class AffineTransform; | 48 class AffineTransform; |
47 class CanvasContextAttributes; | 49 class CanvasContextCreationAttributes; |
48 class CanvasRenderingContext; | 50 class CanvasRenderingContext; |
49 class GraphicsContext; | 51 class GraphicsContext; |
50 class GraphicsContextStateSaver; | 52 class GraphicsContextStateSaver; |
51 class HTMLCanvasElement; | 53 class HTMLCanvasElement; |
52 class Image; | 54 class Image; |
53 class ImageData; | 55 class ImageData; |
54 class ImageBuffer; | 56 class ImageBuffer; |
55 class ImageBufferSurface; | 57 class ImageBufferSurface; |
56 class IntSize; | 58 class IntSize; |
57 class RecordingImageBufferFallbackSurfaceFactory; | 59 class RecordingImageBufferFallbackSurfaceFactory; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 { | 95 { |
94 if (newSize == size()) | 96 if (newSize == size()) |
95 return; | 97 return; |
96 m_ignoreReset = true; | 98 m_ignoreReset = true; |
97 setWidth(newSize.width()); | 99 setWidth(newSize.width()); |
98 setHeight(newSize.height()); | 100 setHeight(newSize.height()); |
99 m_ignoreReset = false; | 101 m_ignoreReset = false; |
100 reset(); | 102 reset(); |
101 } | 103 } |
102 | 104 |
103 CanvasRenderingContext* getContext(const String&, CanvasContextAttributes* a
ttributes = 0); | 105 // Called by HTMLCanvasElement's V8 bindings. |
| 106 ScriptValue getContext(ScriptState*, const String&, const CanvasContextCreat
ionAttributes&); |
| 107 // Called by Document::getCSSCanvasContext as well as above getContext() var
iant. |
| 108 void getContext(const String&, const CanvasContextCreationAttributes&, Canva
sRenderingContext2DOrWebGLRenderingContext&); |
104 bool isPaintable() const; | 109 bool isPaintable() const; |
105 | 110 |
106 static String toEncodingMimeType(const String& mimeType); | 111 static String toEncodingMimeType(const String& mimeType); |
107 String toDataURL(const String& mimeType, const double* quality, ExceptionSta
te&) const; | 112 String toDataURL(const String& mimeType, const double* quality, ExceptionSta
te&) const; |
108 String toDataURL(const String& mimeType, ExceptionState& exceptionState) con
st { return toDataURL(mimeType, 0, exceptionState); } | 113 String toDataURL(const String& mimeType, ExceptionState& exceptionState) con
st { return toDataURL(mimeType, 0, exceptionState); } |
109 | 114 |
110 // Used for rendering | 115 // Used for rendering |
111 void didDraw(const FloatRect&); | 116 void didDraw(const FloatRect&); |
112 void notifyObserversCanvasChanged(const FloatRect&); | 117 void notifyObserversCanvasChanged(const FloatRect&); |
113 | 118 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 bool m_imageBufferIsClear; | 214 bool m_imageBufferIsClear; |
210 OwnPtr<ImageBuffer> m_imageBuffer; | 215 OwnPtr<ImageBuffer> m_imageBuffer; |
211 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver; | 216 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver; |
212 | 217 |
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). | 218 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 }; | 219 }; |
215 | 220 |
216 } // namespace blink | 221 } // namespace blink |
217 | 222 |
218 #endif // HTMLCanvasElement_h | 223 #endif // HTMLCanvasElement_h |
OLD | NEW |