| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #ifndef CanvasImageSource_h | 27 #ifndef CanvasImageSource_h |
| 28 #define CanvasImageSource_h | 28 #define CanvasImageSource_h |
| 29 | 29 |
| 30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
| 31 #include "platform/graphics/GraphicsTypes.h" | |
| 32 #include "wtf/PassRefPtr.h" | 31 #include "wtf/PassRefPtr.h" |
| 33 | 32 |
| 34 namespace blink { | 33 namespace blink { |
| 35 | 34 |
| 36 class Image; | 35 class Image; |
| 37 class SecurityOrigin; | 36 class SecurityOrigin; |
| 38 | 37 |
| 39 enum SourceImageStatus { | 38 enum SourceImageStatus { |
| 40 NormalSourceImageStatus, | 39 NormalSourceImageStatus, |
| 41 UndecodableSourceImageStatus, // Image element with a 'broken' image | 40 UndecodableSourceImageStatus, // Image element with a 'broken' image |
| 42 ZeroSizeCanvasSourceImageStatus, // Source is a canvas with width or heigh o
f zero | 41 ZeroSizeCanvasSourceImageStatus, // Source is a canvas with width or heigh o
f zero |
| 43 IncompleteSourceImageStatus, // Image element with no source media | 42 IncompleteSourceImageStatus, // Image element with no source media |
| 44 InvalidSourceImageStatus, | 43 InvalidSourceImageStatus, |
| 45 }; | 44 }; |
| 46 | 45 |
| 47 class CORE_EXPORT CanvasImageSource { | 46 class CORE_EXPORT CanvasImageSource { |
| 48 public: | 47 public: |
| 49 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, Accele
rationHint) const = 0; | 48 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus* = 0) co
nst = 0; |
| 50 | 49 |
| 51 // IMPORTANT: Result must be independent of whether destinationContext is | 50 // IMPORTANT: Result must be independent of whether destinationContext is |
| 52 // already tainted because this function may be used to determine whether | 51 // already tainted because this function may be used to determine whether |
| 53 // a CanvasPattern is "origin clean", and that pattern may be used on | 52 // a CanvasPattern is "origin clean", and that pattern may be used on |
| 54 // another canvas, which may not be already tainted. | 53 // another canvas, which may not be already tainted. |
| 55 virtual bool wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigin) con
st = 0; | 54 virtual bool wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigin) con
st = 0; |
| 56 | 55 |
| 57 virtual bool isVideoElement() const { return false; } | 56 virtual bool isVideoElement() const { return false; } |
| 58 virtual bool isCanvasElement() const { return false; } | 57 virtual bool isCanvasElement() const { return false; } |
| 59 | 58 |
| 60 // Adjusts the source and destination rectangles for cases where the actual | 59 // Adjusts the source and destination rectangles for cases where the actual |
| 61 // source image is a subregion of the image returned by getSourceImageForCan
vas. | 60 // source image is a subregion of the image returned by getSourceImageForCan
vas. |
| 62 virtual void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const {
} | 61 virtual void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const {
} |
| 63 | 62 |
| 64 virtual FloatSize elementSize() const = 0; | 63 virtual FloatSize elementSize() const = 0; |
| 65 virtual FloatSize defaultDestinationSize() const { return elementSize(); } | 64 virtual FloatSize defaultDestinationSize() const { return elementSize(); } |
| 66 virtual const KURL& sourceURL() const { return blankURL(); } | 65 virtual const KURL& sourceURL() const { return blankURL(); } |
| 67 virtual bool isOpaque() const { return false; } | 66 virtual bool isOpaque() const { return false; } |
| 68 | 67 |
| 69 protected: | 68 protected: |
| 70 virtual ~CanvasImageSource() { } | 69 virtual ~CanvasImageSource() { } |
| 71 }; | 70 }; |
| 72 | 71 |
| 73 } // namespace blink | 72 } // namespace blink |
| 74 | 73 |
| 75 #endif | 74 #endif |
| OLD | NEW |