| Index: Source/core/html/canvas/CanvasImageSource.h
|
| diff --git a/Source/core/html/canvas/CanvasGradient.h b/Source/core/html/canvas/CanvasImageSource.h
|
| similarity index 54%
|
| copy from Source/core/html/canvas/CanvasGradient.h
|
| copy to Source/core/html/canvas/CanvasImageSource.h
|
| index 599534fb31a150d1c430837011bb9d4a393c0858..7c29e059c5a2c6c4c59efd5d0ef8c3e180c95907 100644
|
| --- a/Source/core/html/canvas/CanvasGradient.h
|
| +++ b/Source/core/html/canvas/CanvasImageSource.h
|
| @@ -24,41 +24,47 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef CanvasGradient_h
|
| -#define CanvasGradient_h
|
| +#ifndef CanvasImageSource_h
|
| +#define CanvasImageSource_h
|
|
|
| -#include "bindings/v8/ScriptWrappable.h"
|
| -#include "platform/graphics/Gradient.h"
|
| -#include "wtf/Forward.h"
|
| #include "wtf/PassRefPtr.h"
|
| -#include "wtf/RefCounted.h"
|
| +
|
| +using namespace WTF;
|
|
|
| namespace WebCore {
|
|
|
| class ExceptionState;
|
| +class HTMLCanvasElement;
|
| +class Image;
|
| +
|
| +enum CanvasImageSourceUsage {
|
| + PatternCanvasImageSourceUsage,
|
| + DrawCanvasImageSourceUsage
|
| +};
|
|
|
| -class CanvasGradient : public RefCounted<CanvasGradient>, public ScriptWrappable {
|
| +class CanvasImageSource {
|
| public:
|
| - static PassRefPtr<CanvasGradient> create(const FloatPoint& p0, const FloatPoint& p1)
|
| - {
|
| - return adoptRef(new CanvasGradient(p0, p1));
|
| - }
|
| - static PassRefPtr<CanvasGradient> create(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1)
|
| - {
|
| - return adoptRef(new CanvasGradient(p0, r0, p1, r1));
|
| - }
|
| + virtual PassRefPtr<Image> getSourceImageForCanvas(HTMLCanvasElement*, ExceptionState&, CanvasImageSourceUsage, bool* isVolatile = 0) const = 0;
|
| +
|
| + // IMPORTANT: Result must be independent of whether destinationContext is
|
| + // already tainted because this function may be used to determine whether
|
| + // a CanvasPattern is "origin clean", and that pattern may be used on
|
| + // another canvas, which may not be already tainted.
|
| + virtual bool wouldTaintOrigin(CanvasRenderingContext* destinationContext) const = 0;
|
|
|
| - Gradient* gradient() const { return m_gradient.get(); }
|
| + virtual bool isVideoElement() const { return false; }
|
|
|
| - void addColorStop(float value, const String& color, ExceptionState&);
|
| + // Adjusts the source and destination rectangles for cases where the actual
|
| + // source image is a subregion of the image returned by getSourceImageForCanvas.
|
| + virtual void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const { }
|
|
|
| -private:
|
| - CanvasGradient(const FloatPoint& p0, const FloatPoint& p1);
|
| - CanvasGradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1);
|
| + virtual FloatSize sourceSize() const = 0;
|
| + virtual FloatSize defaultDestinationSize() const { return sourceSize(); }
|
|
|
| - RefPtr<Gradient> m_gradient;
|
| +protected:
|
| + virtual ~CanvasImageSource() { }
|
| };
|
|
|
| -} //namespace
|
| +} // namespace WebCore
|
|
|
| #endif
|
|
|