#ifndef SVGImageForContainer_h
#define SVGImageForContainer_h
#include "core/svg/graphics/SVGImage.h"
#include "platform/geometry/FloatRect.h"
#include "platform/geometry/FloatSize.h"
#include "platform/graphics/Image.h"
namespace WebCore {
class SVGImageForContainer FINAL : public Image {
public:
static PassRefPtr<SVGImageForContainer> create(SVGImage* image, const FloatSize& containerSize, float zoom)
{
return adoptRef(new SVGImageForContainer(image, containerSize, zoom));
}
virtual bool isSVGImage() const OVERRIDE { return true; }
virtual IntSize size() const OVERRIDE;
virtual bool usesContainerSize() const OVERRIDE { return m_image->usesContainerSize(); }
virtual bool hasRelativeWidth() const OVERRIDE { return m_image->hasRelativeWidth(); }
virtual bool hasRelativeHeight() const OVERRIDE { return m_image->hasRelativeHeight(); }
virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) OVERRIDE
{
m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio);
}
virtual void draw(GraphicsContext*, const FloatRect&, const FloatRect&, CompositeOperator, blink::WebBlendMode) OVERRIDE;
virtual void drawPattern(GraphicsContext*, const FloatRect&, const FloatSize&, const FloatPoint&, CompositeOperator, const FloatRect&, blink::WebBlendMode, const IntSize& repeatSpacing) OVERRIDE;
virtual bool currentFrameKnownToBeOpaque() OVERRIDE { return false; }
virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE;
private:
SVGImageForContainer(SVGImage* image, const FloatSize& containerSize, float zoom)
: m_image(image)
, m_containerSize(containerSize)
, m_zoom(zoom)
{
}
virtual void destroyDecodedData(bool) OVERRIDE { }
SVGImage* m_image;
const FloatSize m_containerSize;
const float m_zoom;
};
}
#endif