| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 m_ignoreReset = true; | 90 m_ignoreReset = true; |
| 91 setWidth(newSize.width()); | 91 setWidth(newSize.width()); |
| 92 setHeight(newSize.height()); | 92 setHeight(newSize.height()); |
| 93 m_ignoreReset = false; | 93 m_ignoreReset = false; |
| 94 reset(); | 94 reset(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 CanvasRenderingContext* getContext(const String&, CanvasContextAttributes* a
ttributes = 0); | 97 CanvasRenderingContext* getContext(const String&, CanvasContextAttributes* a
ttributes = 0); |
| 98 | 98 |
| 99 static String toEncodingMimeType(const String& mimeType); | 99 static String toEncodingMimeType(const String& mimeType); |
| 100 String toDataURL(const String& mimeType, const double* quality, ExceptionSta
te&); | 100 String toDataURL(const String& mimeType, const double* quality, ExceptionSta
te&) const; |
| 101 String toDataURL(const String& mimeType, ExceptionState& exceptionState) { r
eturn toDataURL(mimeType, 0, exceptionState); } | 101 String toDataURL(const String& mimeType, ExceptionState& exceptionState) con
st { return toDataURL(mimeType, 0, exceptionState); } |
| 102 | 102 |
| 103 // Used for rendering | 103 // Used for rendering |
| 104 void didDraw(const FloatRect&); | 104 void didDraw(const FloatRect&); |
| 105 void notifyObserversCanvasChanged(const FloatRect&); | 105 void notifyObserversCanvasChanged(const FloatRect&); |
| 106 | 106 |
| 107 void paint(GraphicsContext*, const LayoutRect&); | 107 void paint(GraphicsContext*, const LayoutRect&); |
| 108 | 108 |
| 109 GraphicsContext* drawingContext() const; | 109 GraphicsContext* drawingContext() const; |
| 110 GraphicsContext* existingDrawingContext() const; | 110 GraphicsContext* existingDrawingContext() const; |
| 111 | 111 |
| 112 CanvasRenderingContext* renderingContext() const { return m_context.get(); } | 112 CanvasRenderingContext* renderingContext() const { return m_context.get(); } |
| 113 | 113 |
| 114 void ensureUnacceleratedImageBuffer(); | 114 void ensureUnacceleratedImageBuffer(); |
| 115 ImageBuffer* buffer() const; | 115 ImageBuffer* buffer() const; |
| 116 Image* copiedImage() const; | 116 Image* copiedImage() const; |
| 117 void clearCopiedImage(); | 117 void clearCopiedImage(); |
| 118 PassRefPtrWillBeRawPtr<ImageData> getImageData(); | 118 PassRefPtrWillBeRawPtr<ImageData> getImageData() const; |
| 119 void makePresentationCopy(); | 119 void makePresentationCopy(); |
| 120 void clearPresentationCopy(); | 120 void clearPresentationCopy(); |
| 121 | 121 |
| 122 SecurityOrigin* securityOrigin() const; | 122 SecurityOrigin* securityOrigin() const; |
| 123 bool originClean() const { return m_originClean; } | 123 bool originClean() const { return m_originClean; } |
| 124 void setOriginTainted() { m_originClean = false; } | 124 void setOriginTainted() { m_originClean = false; } |
| 125 | 125 |
| 126 AffineTransform baseTransform() const; | 126 AffineTransform baseTransform() const; |
| 127 | 127 |
| 128 bool is3D() const; | 128 bool is3D() const; |
| 129 | 129 |
| 130 bool hasImageBuffer() const { return m_imageBuffer; } | 130 bool hasImageBuffer() const { return m_imageBuffer; } |
| 131 bool hasValidImageBuffer() const; | 131 bool hasValidImageBuffer() const; |
| 132 void discardImageBuffer(); | 132 void discardImageBuffer(); |
| 133 | 133 |
| 134 bool shouldAccelerate(const IntSize&) const; | 134 bool shouldAccelerate(const IntSize&) const; |
| 135 | 135 |
| 136 virtual const AtomicString imageSourceURL() const OVERRIDE; |
| 137 |
| 136 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; | 138 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; |
| 137 | 139 |
| 138 // DocumentVisibilityObserver implementation | 140 // DocumentVisibilityObserver implementation |
| 139 virtual void didChangeVisibilityState(PageVisibilityState) OVERRIDE; | 141 virtual void didChangeVisibilityState(PageVisibilityState) OVERRIDE; |
| 140 | 142 |
| 141 // CanvasImageSource implementation | 143 // CanvasImageSource implementation |
| 142 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma
geStatus*) const OVERRIDE; | 144 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma
geStatus*) const OVERRIDE; |
| 143 virtual bool wouldTaintOrigin(SecurityOrigin*) const OVERRIDE; | 145 virtual bool wouldTaintOrigin(SecurityOrigin*) const OVERRIDE; |
| 144 virtual FloatSize sourceSize() const OVERRIDE; | 146 virtual FloatSize sourceSize() const OVERRIDE; |
| 145 | 147 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 164 void createImageBuffer(); | 166 void createImageBuffer(); |
| 165 void createImageBufferInternal(); | 167 void createImageBufferInternal(); |
| 166 void clearImageBuffer(); | 168 void clearImageBuffer(); |
| 167 | 169 |
| 168 void setSurfaceSize(const IntSize&); | 170 void setSurfaceSize(const IntSize&); |
| 169 | 171 |
| 170 bool paintsIntoCanvasBuffer() const; | 172 bool paintsIntoCanvasBuffer() const; |
| 171 | 173 |
| 172 void updateExternallyAllocatedMemory() const; | 174 void updateExternallyAllocatedMemory() const; |
| 173 | 175 |
| 176 String toDataURLInternal(const String& mimeType, const double* quality) cons
t; |
| 177 |
| 174 HashSet<CanvasObserver*> m_observers; | 178 HashSet<CanvasObserver*> m_observers; |
| 175 | 179 |
| 176 IntSize m_size; | 180 IntSize m_size; |
| 177 | 181 |
| 178 OwnPtrWillBeMember<CanvasRenderingContext> m_context; | 182 OwnPtrWillBeMember<CanvasRenderingContext> m_context; |
| 179 | 183 |
| 180 bool m_rendererIsCanvas; | 184 bool m_rendererIsCanvas; |
| 181 | 185 |
| 182 bool m_ignoreReset; | 186 bool m_ignoreReset; |
| 183 bool m_accelerationDisabled; | 187 bool m_accelerationDisabled; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 194 OwnPtr<ImageBuffer> m_imageBuffer; | 198 OwnPtr<ImageBuffer> m_imageBuffer; |
| 195 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver; | 199 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver; |
| 196 | 200 |
| 197 mutable RefPtr<Image> m_presentedImage; | 201 mutable RefPtr<Image> m_presentedImage; |
| 198 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). | 202 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). |
| 199 }; | 203 }; |
| 200 | 204 |
| 201 } //namespace | 205 } //namespace |
| 202 | 206 |
| 203 #endif | 207 #endif |
| OLD | NEW |