Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 #define HTMLCanvasElement_h | 29 #define HTMLCanvasElement_h |
| 30 | 30 |
| 31 #include "bindings/core/v8/ScriptValue.h" | 31 #include "bindings/core/v8/ScriptValue.h" |
| 32 #include "bindings/core/v8/UnionTypesCore.h" | 32 #include "bindings/core/v8/UnionTypesCore.h" |
| 33 #include "core/CoreExport.h" | 33 #include "core/CoreExport.h" |
| 34 #include "core/dom/DOMTypedArray.h" | 34 #include "core/dom/DOMTypedArray.h" |
| 35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/dom/DocumentVisibilityObserver.h" | 36 #include "core/dom/DocumentVisibilityObserver.h" |
| 37 #include "core/fileapi/FileCallback.h" | 37 #include "core/fileapi/FileCallback.h" |
| 38 #include "core/html/HTMLElement.h" | 38 #include "core/html/HTMLElement.h" |
| 39 #include "core/html/canvas/CanvasDrawListener.h" | |
| 39 #include "core/html/canvas/CanvasImageSource.h" | 40 #include "core/html/canvas/CanvasImageSource.h" |
| 40 #include "platform/geometry/FloatRect.h" | 41 #include "platform/geometry/FloatRect.h" |
| 41 #include "platform/geometry/IntSize.h" | 42 #include "platform/geometry/IntSize.h" |
| 42 #include "platform/graphics/GraphicsTypes.h" | 43 #include "platform/graphics/GraphicsTypes.h" |
| 43 #include "platform/graphics/GraphicsTypes3D.h" | 44 #include "platform/graphics/GraphicsTypes3D.h" |
| 44 #include "platform/graphics/ImageBufferClient.h" | 45 #include "platform/graphics/ImageBufferClient.h" |
| 45 #include "platform/heap/Handle.h" | 46 #include "platform/heap/Handle.h" |
| 46 | 47 |
| 47 #define CanvasDefaultInterpolationQuality InterpolationLow | 48 #define CanvasDefaultInterpolationQuality InterpolationLow |
| 48 | 49 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 | 95 |
| 95 bool isPaintable() const; | 96 bool isPaintable() const; |
| 96 | 97 |
| 97 static String toEncodingMimeType(const String& mimeType); | 98 static String toEncodingMimeType(const String& mimeType); |
| 98 String toDataURL(const String& mimeType, const ScriptValue& qualityArgument, ExceptionState&) const; | 99 String toDataURL(const String& mimeType, const ScriptValue& qualityArgument, ExceptionState&) const; |
| 99 String toDataURL(const String& mimeType, ExceptionState& exceptionState) con st { return toDataURL(mimeType, ScriptValue(), exceptionState); } | 100 String toDataURL(const String& mimeType, ExceptionState& exceptionState) con st { return toDataURL(mimeType, ScriptValue(), exceptionState); } |
| 100 | 101 |
| 101 void toBlob(FileCallback*, const String& mimeType, const ScriptValue& qualit yArgument, ExceptionState&); | 102 void toBlob(FileCallback*, const String& mimeType, const ScriptValue& qualit yArgument, ExceptionState&); |
| 102 void toBlob(FileCallback* callback, const String& mimeType, ExceptionState& exceptionState) { return toBlob(callback, mimeType, ScriptValue(), exceptionStat e); } | 103 void toBlob(FileCallback* callback, const String& mimeType, ExceptionState& exceptionState) { return toBlob(callback, mimeType, ScriptValue(), exceptionStat e); } |
| 103 | 104 |
| 105 // Used for canvas capture. | |
| 106 void addListener(CanvasDrawListener*); | |
| 107 void removeListener(CanvasDrawListener*); | |
| 108 | |
| 104 // Used for rendering | 109 // Used for rendering |
| 105 void didDraw(const FloatRect&); | 110 void didDraw(const FloatRect&); |
| 106 | 111 |
| 107 void paint(GraphicsContext*, const LayoutRect&); | 112 void paint(GraphicsContext*, const LayoutRect&); |
| 108 | 113 |
| 109 SkCanvas* drawingCanvas() const; | 114 SkCanvas* drawingCanvas() const; |
| 110 void disableDeferral() const; | 115 void disableDeferral() const; |
| 111 SkCanvas* existingDrawingCanvas() const; | 116 SkCanvas* existingDrawingCanvas() const; |
| 112 | 117 |
| 113 void setRenderingContext(PassOwnPtrWillBeRawPtr<CanvasRenderingContext>); | 118 void setRenderingContext(PassOwnPtrWillBeRawPtr<CanvasRenderingContext>); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 | 191 |
| 187 PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& devic eSize, int* msaaSampleCount); | 192 PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& devic eSize, int* msaaSampleCount); |
| 188 void createImageBuffer(); | 193 void createImageBuffer(); |
| 189 void createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurfac e); | 194 void createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurfac e); |
| 190 bool shouldUseDisplayList(const IntSize& deviceSize); | 195 bool shouldUseDisplayList(const IntSize& deviceSize); |
| 191 | 196 |
| 192 void setSurfaceSize(const IntSize&); | 197 void setSurfaceSize(const IntSize&); |
| 193 | 198 |
| 194 bool paintsIntoCanvasBuffer() const; | 199 bool paintsIntoCanvasBuffer() const; |
| 195 | 200 |
| 201 void notifyListenersCanvasChanged(); | |
| 202 | |
| 196 ImageData* toImageData(SourceDrawingBuffer) const; | 203 ImageData* toImageData(SourceDrawingBuffer) const; |
| 197 String toDataURLInternal(const String& mimeType, const double& quality, Sour ceDrawingBuffer) const; | 204 String toDataURLInternal(const String& mimeType, const double& quality, Sour ceDrawingBuffer) const; |
| 198 | 205 |
| 206 WillBeHeapHashSet<RawPtrWillBeMember<CanvasDrawListener>> m_listeners; | |
|
peria
2015/11/24 05:50:22
Can this type be
PersistentHeapHashSetWillBeHeapHa
emircan
2015/11/24 22:16:51
Done.
| |
| 207 | |
| 199 IntSize m_size; | 208 IntSize m_size; |
| 200 | 209 |
| 201 OwnPtrWillBeMember<CanvasRenderingContext> m_context; | 210 OwnPtrWillBeMember<CanvasRenderingContext> m_context; |
| 202 | 211 |
| 203 bool m_ignoreReset; | 212 bool m_ignoreReset; |
| 204 FloatRect m_dirtyRect; | 213 FloatRect m_dirtyRect; |
| 205 | 214 |
| 206 mutable intptr_t m_externallyAllocatedMemory; | 215 mutable intptr_t m_externallyAllocatedMemory; |
| 207 | 216 |
| 208 bool m_originClean; | 217 bool m_originClean; |
| 209 | 218 |
| 210 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t o allocate an imageBuffer | 219 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t o allocate an imageBuffer |
| 211 // after the first attempt failed. | 220 // after the first attempt failed. |
| 212 mutable bool m_didFailToCreateImageBuffer; | 221 mutable bool m_didFailToCreateImageBuffer; |
| 213 bool m_imageBufferIsClear; | 222 bool m_imageBufferIsClear; |
| 214 OwnPtr<ImageBuffer> m_imageBuffer; | 223 OwnPtr<ImageBuffer> m_imageBuffer; |
| 215 | 224 |
| 216 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue). | 225 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue). |
| 217 }; | 226 }; |
| 218 | 227 |
| 219 } // namespace blink | 228 } // namespace blink |
| 220 | 229 |
| 221 #endif // HTMLCanvasElement_h | 230 #endif // HTMLCanvasElement_h |
| OLD | NEW |