SVGImageForContainer.h [plain text]
#pragma once
#include "AffineTransform.h"
#include "FloatRect.h"
#include "FloatSize.h"
#include "Image.h"
#include "SVGImage.h"
#include "URL.h"
namespace WebCore {
class SVGImageForContainer final : public Image {
public:
static Ref<SVGImageForContainer> create(SVGImage* image, const FloatSize& containerSize, float containerZoom, const URL& initialFragmentURL)
{
return adoptRef(*new SVGImageForContainer(image, containerSize, containerZoom, initialFragmentURL));
}
bool isSVGImage() const final { return true; }
FloatSize size() const final;
bool usesContainerSize() const final { return m_image->usesContainerSize(); }
bool hasRelativeWidth() const final { return m_image->hasRelativeWidth(); }
bool hasRelativeHeight() const final { return m_image->hasRelativeHeight(); }
void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) final
{
m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio);
}
ImageDrawResult draw(GraphicsContext&, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode, DecodingMode, ImageOrientationDescription) final;
void drawPattern(GraphicsContext&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, CompositeOperator, BlendMode) final;
bool currentFrameKnownToBeOpaque() const final { return false; }
NativeImagePtr nativeImageForCurrentFrame(const GraphicsContext* = nullptr) final;
private:
SVGImageForContainer(SVGImage* image, const FloatSize& containerSize, float containerZoom, const URL& initialFragmentURL)
: m_image(image)
, m_containerSize(containerSize)
, m_containerZoom(containerZoom)
, m_initialFragmentURL(initialFragmentURL)
{
}
void destroyDecodedData(bool = true) final { }
SVGImage* m_image;
const FloatSize m_containerSize;
const float m_containerZoom;
const URL m_initialFragmentURL;
};
}