| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // Used for canvas capture. | 106 // Used for canvas capture. |
| 107 void addListener(CanvasDrawListener*); | 107 void addListener(CanvasDrawListener*); |
| 108 void removeListener(CanvasDrawListener*); | 108 void removeListener(CanvasDrawListener*); |
| 109 | 109 |
| 110 // Used for rendering | 110 // Used for rendering |
| 111 void didDraw(const FloatRect&); | 111 void didDraw(const FloatRect&); |
| 112 | 112 |
| 113 void paint(GraphicsContext&, const LayoutRect&); | 113 void paint(GraphicsContext&, const LayoutRect&); |
| 114 | 114 |
| 115 SkCanvas* drawingCanvas() const; | 115 SkCanvas* drawingCanvas() const; |
| 116 void disableDeferral() const; | 116 void disableDeferral(DisableDeferralReason) const; |
| 117 SkCanvas* existingDrawingCanvas() const; | 117 SkCanvas* existingDrawingCanvas() const; |
| 118 | 118 |
| 119 void setRenderingContext(PassOwnPtrWillBeRawPtr<CanvasRenderingContext>); | 119 void setRenderingContext(PassOwnPtrWillBeRawPtr<CanvasRenderingContext>); |
| 120 CanvasRenderingContext* renderingContext() const { return m_context.get(); } | 120 CanvasRenderingContext* renderingContext() const { return m_context.get(); } |
| 121 | 121 |
| 122 void ensureUnacceleratedImageBuffer(); | 122 void ensureUnacceleratedImageBuffer(); |
| 123 ImageBuffer* buffer() const; | 123 ImageBuffer* buffer() const; |
| 124 PassRefPtr<Image> copiedImage(SourceDrawingBuffer, AccelerationHint) const; | 124 PassRefPtr<Image> copiedImage(SourceDrawingBuffer, AccelerationHint) const; |
| 125 void clearCopiedImage(); | 125 void clearCopiedImage(); |
| 126 | 126 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 143 void prepareSurfaceForPaintingIfNeeded() const; | 143 void prepareSurfaceForPaintingIfNeeded() const; |
| 144 | 144 |
| 145 const AtomicString imageSourceURL() const override; | 145 const AtomicString imageSourceURL() const override; |
| 146 | 146 |
| 147 InsertionNotificationRequest insertedInto(ContainerNode*) override; | 147 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
| 148 | 148 |
| 149 // DocumentVisibilityObserver implementation | 149 // DocumentVisibilityObserver implementation |
| 150 void didChangeVisibilityState(PageVisibilityState) override; | 150 void didChangeVisibilityState(PageVisibilityState) override; |
| 151 | 151 |
| 152 // CanvasImageSource implementation | 152 // CanvasImageSource implementation |
| 153 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt) const override; | 153 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt, SnapshotReason) const override; |
| 154 bool wouldTaintOrigin(SecurityOrigin*) const override; | 154 bool wouldTaintOrigin(SecurityOrigin*) const override; |
| 155 FloatSize elementSize() const override; | 155 FloatSize elementSize() const override; |
| 156 bool isCanvasElement() const override { return true; } | 156 bool isCanvasElement() const override { return true; } |
| 157 bool isOpaque() const override; | 157 bool isOpaque() const override; |
| 158 | 158 |
| 159 // ImageBufferClient implementation | 159 // ImageBufferClient implementation |
| 160 void notifySurfaceInvalid() override; | 160 void notifySurfaceInvalid() override; |
| 161 bool isDirty() override { return !m_dirtyRect.isEmpty(); } | 161 bool isDirty() override { return !m_dirtyRect.isEmpty(); } |
| 162 void didFinalizeFrame() override; | 162 void didFinalizeFrame() override; |
| 163 void restoreCanvasMatrixClipStack(SkCanvas*) const override; | 163 void restoreCanvasMatrixClipStack(SkCanvas*) const override; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 void createImageBuffer(); | 198 void createImageBuffer(); |
| 199 void createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurfac
e); | 199 void createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurfac
e); |
| 200 bool shouldUseDisplayList(const IntSize& deviceSize); | 200 bool shouldUseDisplayList(const IntSize& deviceSize); |
| 201 | 201 |
| 202 void setSurfaceSize(const IntSize&); | 202 void setSurfaceSize(const IntSize&); |
| 203 | 203 |
| 204 bool paintsIntoCanvasBuffer() const; | 204 bool paintsIntoCanvasBuffer() const; |
| 205 | 205 |
| 206 void notifyListenersCanvasChanged(); | 206 void notifyListenersCanvasChanged(); |
| 207 | 207 |
| 208 ImageData* toImageData(SourceDrawingBuffer) const; | 208 ImageData* toImageData(SourceDrawingBuffer, SnapshotReason) const; |
| 209 String toDataURLInternal(const String& mimeType, const double& quality, Sour
ceDrawingBuffer) const; | 209 String toDataURLInternal(const String& mimeType, const double& quality, Sour
ceDrawingBuffer) const; |
| 210 | 210 |
| 211 PersistentHeapHashSetWillBeHeapHashSet<WeakMember<CanvasDrawListener>> m_lis
teners; | 211 PersistentHeapHashSetWillBeHeapHashSet<WeakMember<CanvasDrawListener>> m_lis
teners; |
| 212 | 212 |
| 213 IntSize m_size; | 213 IntSize m_size; |
| 214 | 214 |
| 215 OwnPtrWillBeMember<CanvasRenderingContext> m_context; | 215 OwnPtrWillBeMember<CanvasRenderingContext> m_context; |
| 216 | 216 |
| 217 bool m_ignoreReset; | 217 bool m_ignoreReset; |
| 218 FloatRect m_dirtyRect; | 218 FloatRect m_dirtyRect; |
| 219 | 219 |
| 220 mutable intptr_t m_externallyAllocatedMemory; | 220 mutable intptr_t m_externallyAllocatedMemory; |
| 221 | 221 |
| 222 bool m_originClean; | 222 bool m_originClean; |
| 223 | 223 |
| 224 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t
o allocate an imageBuffer | 224 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t
o allocate an imageBuffer |
| 225 // after the first attempt failed. | 225 // after the first attempt failed. |
| 226 mutable bool m_didFailToCreateImageBuffer; | 226 mutable bool m_didFailToCreateImageBuffer; |
| 227 bool m_imageBufferIsClear; | 227 bool m_imageBufferIsClear; |
| 228 OwnPtr<ImageBuffer> m_imageBuffer; | 228 OwnPtr<ImageBuffer> m_imageBuffer; |
| 229 | 229 |
| 230 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). | 230 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). |
| 231 }; | 231 }; |
| 232 | 232 |
| 233 } // namespace blink | 233 } // namespace blink |
| 234 | 234 |
| 235 #endif // HTMLCanvasElement_h | 235 #endif // HTMLCanvasElement_h |
| OLD | NEW |