| 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 20 matching lines...) Expand all Loading... |
| 31 #include "platform/graphics/GraphicsTypes.h" | 31 #include "platform/graphics/GraphicsTypes.h" |
| 32 #include "wtf/PassRefPtr.h" | 32 #include "wtf/PassRefPtr.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 class Image; | 36 class Image; |
| 37 class SecurityOrigin; | 37 class SecurityOrigin; |
| 38 | 38 |
| 39 enum SourceImageStatus { | 39 enum SourceImageStatus { |
| 40 NormalSourceImageStatus, | 40 NormalSourceImageStatus, |
| 41 UndecodableSourceImageStatus, // Image element with a 'broken' image | 41 UndecodableSourceImageStatus, // Image element with a 'broken' image |
| 42 ZeroSizeCanvasSourceImageStatus, // Source is a canvas with width or heigh of
zero | 42 ZeroSizeCanvasSourceImageStatus, // Source is a canvas with width or heigh of |
| 43 IncompleteSourceImageStatus, // Image element with no source media | 43 // zero |
| 44 IncompleteSourceImageStatus, // Image element with no source media |
| 44 InvalidSourceImageStatus, | 45 InvalidSourceImageStatus, |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 class CORE_EXPORT CanvasImageSource { | 48 class CORE_EXPORT CanvasImageSource { |
| 48 public: | 49 public: |
| 49 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, | 50 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, |
| 50 AccelerationHint, | 51 AccelerationHint, |
| 51 SnapshotReason, | 52 SnapshotReason, |
| 52 const FloatSize&) const = 0; | 53 const FloatSize&) const = 0; |
| 53 | 54 |
| 54 // IMPORTANT: Result must be independent of whether destinationContext is | 55 // IMPORTANT: Result must be independent of whether destinationContext is |
| 55 // already tainted because this function may be used to determine whether | 56 // already tainted because this function may be used to determine whether |
| 56 // a CanvasPattern is "origin clean", and that pattern may be used on | 57 // a CanvasPattern is "origin clean", and that pattern may be used on |
| 57 // another canvas, which may not be already tainted. | 58 // another canvas, which may not be already tainted. |
| 58 virtual bool wouldTaintOrigin( | 59 virtual bool wouldTaintOrigin( |
| 59 SecurityOrigin* destinationSecurityOrigin) const = 0; | 60 SecurityOrigin* destinationSecurityOrigin) const = 0; |
| 60 | 61 |
| 61 virtual bool isCSSImageValue() const { return false; } | 62 virtual bool isCSSImageValue() const { return false; } |
| 62 virtual bool isVideoElement() const { return false; } | 63 virtual bool isVideoElement() const { return false; } |
| 63 virtual bool isCanvasElement() const { return false; } | 64 virtual bool isCanvasElement() const { return false; } |
| 64 virtual bool isSVGSource() const { return false; } | 65 virtual bool isSVGSource() const { return false; } |
| 65 virtual bool isImageBitmap() const { return false; } | 66 virtual bool isImageBitmap() const { return false; } |
| 66 virtual bool isOffscreenCanvas() const { return false; } | 67 virtual bool isOffscreenCanvas() const { return false; } |
| 67 | 68 |
| 68 // Adjusts the source and destination rectangles for cases where the actual | 69 // Adjusts the source and destination rectangles for cases where the actual |
| 69 // source image is a subregion of the image returned by getSourceImageForCanva
s. | 70 // source image is a subregion of the image returned by |
| 71 // getSourceImageForCanvas. |
| 70 virtual void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const {} | 72 virtual void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const {} |
| 71 | 73 |
| 72 virtual FloatSize elementSize(const FloatSize& defaultObjectSize) const = 0; | 74 virtual FloatSize elementSize(const FloatSize& defaultObjectSize) const = 0; |
| 73 virtual FloatSize defaultDestinationSize( | 75 virtual FloatSize defaultDestinationSize( |
| 74 const FloatSize& defaultObjectSize) const { | 76 const FloatSize& defaultObjectSize) const { |
| 75 return elementSize(defaultObjectSize); | 77 return elementSize(defaultObjectSize); |
| 76 } | 78 } |
| 77 virtual const KURL& sourceURL() const { return blankURL(); } | 79 virtual const KURL& sourceURL() const { return blankURL(); } |
| 78 virtual bool isOpaque() const { return false; } | 80 virtual bool isOpaque() const { return false; } |
| 79 virtual bool isAccelerated() const = 0; | 81 virtual bool isAccelerated() const = 0; |
| 80 | 82 |
| 81 virtual int sourceWidth() = 0; | 83 virtual int sourceWidth() = 0; |
| 82 virtual int sourceHeight() = 0; | 84 virtual int sourceHeight() = 0; |
| 83 | 85 |
| 84 protected: | 86 protected: |
| 85 virtual ~CanvasImageSource() {} | 87 virtual ~CanvasImageSource() {} |
| 86 }; | 88 }; |
| 87 | 89 |
| 88 } // namespace blink | 90 } // namespace blink |
| 89 | 91 |
| 90 #endif | 92 #endif |
| OLD | NEW |