| 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/UnionTypesCore.h" |
| 31 #include "core/dom/Document.h" | 32 #include "core/dom/Document.h" |
| 32 #include "core/html/HTMLElement.h" | 33 #include "core/html/HTMLElement.h" |
| 33 #include "core/html/canvas/CanvasImageSource.h" | 34 #include "core/html/canvas/CanvasImageSource.h" |
| 34 #include "platform/geometry/FloatRect.h" | 35 #include "platform/geometry/FloatRect.h" |
| 35 #include "platform/geometry/IntSize.h" | 36 #include "platform/geometry/IntSize.h" |
| 36 #include "platform/graphics/GraphicsTypes.h" | 37 #include "platform/graphics/GraphicsTypes.h" |
| 37 #include "platform/graphics/GraphicsTypes3D.h" | 38 #include "platform/graphics/GraphicsTypes3D.h" |
| 38 #include "platform/graphics/ImageBufferClient.h" | 39 #include "platform/graphics/ImageBufferClient.h" |
| 39 #include "platform/heap/Handle.h" | 40 #include "platform/heap/Handle.h" |
| 40 #include "public/platform/WebThread.h" | 41 #include "public/platform/WebThread.h" |
| 41 | 42 |
| 42 #define CanvasDefaultInterpolationQuality InterpolationLow | 43 #define CanvasDefaultInterpolationQuality InterpolationLow |
| 43 | 44 |
| 44 namespace blink { | 45 namespace blink { |
| 45 | 46 |
| 46 class AffineTransform; | 47 class AffineTransform; |
| 47 class CanvasContextAttributes; | 48 class CanvasContextCreationAttributes; |
| 48 class CanvasRenderingContext; | 49 class CanvasRenderingContext; |
| 49 class GraphicsContext; | 50 class GraphicsContext; |
| 50 class GraphicsContextStateSaver; | 51 class GraphicsContextStateSaver; |
| 51 class HTMLCanvasElement; | 52 class HTMLCanvasElement; |
| 52 class Image; | 53 class Image; |
| 53 class ImageData; | 54 class ImageData; |
| 54 class ImageBuffer; | 55 class ImageBuffer; |
| 55 class ImageBufferSurface; | 56 class ImageBufferSurface; |
| 56 class IntSize; | 57 class IntSize; |
| 57 class RecordingImageBufferFallbackSurfaceFactory; | 58 class RecordingImageBufferFallbackSurfaceFactory; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 { | 94 { |
| 94 if (newSize == size()) | 95 if (newSize == size()) |
| 95 return; | 96 return; |
| 96 m_ignoreReset = true; | 97 m_ignoreReset = true; |
| 97 setWidth(newSize.width()); | 98 setWidth(newSize.width()); |
| 98 setHeight(newSize.height()); | 99 setHeight(newSize.height()); |
| 99 m_ignoreReset = false; | 100 m_ignoreReset = false; |
| 100 reset(); | 101 reset(); |
| 101 } | 102 } |
| 102 | 103 |
| 103 CanvasRenderingContext* getContext(const String&, CanvasContextAttributes* a
ttributes = 0); | 104 void getContext(const String&, const CanvasContextCreationAttributes&, Canva
sRenderingContext2DOrWebGLRenderingContext& result); |
| 104 bool isPaintable() const; | 105 bool isPaintable() const; |
| 105 | 106 |
| 106 static String toEncodingMimeType(const String& mimeType); | 107 static String toEncodingMimeType(const String& mimeType); |
| 107 String toDataURL(const String& mimeType, const double* quality, ExceptionSta
te&) const; | 108 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); } | 109 String toDataURL(const String& mimeType, ExceptionState& exceptionState) con
st { return toDataURL(mimeType, 0, exceptionState); } |
| 109 | 110 |
| 110 // Used for rendering | 111 // Used for rendering |
| 111 void didDraw(const FloatRect&); | 112 void didDraw(const FloatRect&); |
| 112 void notifyObserversCanvasChanged(const FloatRect&); | 113 void notifyObserversCanvasChanged(const FloatRect&); |
| 113 | 114 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 bool m_imageBufferIsClear; | 210 bool m_imageBufferIsClear; |
| 210 OwnPtr<ImageBuffer> m_imageBuffer; | 211 OwnPtr<ImageBuffer> m_imageBuffer; |
| 211 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver; | 212 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver; |
| 212 | 213 |
| 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). | 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 }; | 215 }; |
| 215 | 216 |
| 216 } // namespace blink | 217 } // namespace blink |
| 217 | 218 |
| 218 #endif // HTMLCanvasElement_h | 219 #endif // HTMLCanvasElement_h |
| OLD | NEW |