SVGPaintServerPattern.cpp [plain text]
#include "config.h"
#if ENABLE(SVG)
#include "SVGPaintServerPattern.h"
#include "ImageBuffer.h"
#include "SVGPatternElement.h"
#include "SVGRenderTreeAsText.h"
using namespace std;
namespace WebCore {
SVGPaintServerPattern::SVGPaintServerPattern(const SVGPatternElement* owner)
: m_ownerElement(owner)
#if PLATFORM(CG)
, m_patternSpace(0)
, m_pattern(0)
#endif
{
ASSERT(owner);
}
SVGPaintServerPattern::~SVGPaintServerPattern()
{
#if PLATFORM(CG)
CGPatternRelease(m_pattern);
CGColorSpaceRelease(m_patternSpace);
#endif
}
FloatRect SVGPaintServerPattern::patternBoundaries() const
{
return m_patternBoundaries;
}
void SVGPaintServerPattern::setPatternBoundaries(const FloatRect& rect)
{
m_patternBoundaries = rect;
}
ImageBuffer* SVGPaintServerPattern::tile() const
{
return m_tile.get();
}
void SVGPaintServerPattern::setTile(auto_ptr<ImageBuffer> tile)
{
m_tile.set(tile.release());
}
AffineTransform SVGPaintServerPattern::patternTransform() const
{
return m_patternTransform;
}
void SVGPaintServerPattern::setPatternTransform(const AffineTransform& transform)
{
m_patternTransform = transform;
}
TextStream& SVGPaintServerPattern::externalRepresentation(TextStream& ts) const
{
m_ownerElement->buildPattern(FloatRect(0.0f, 0.0f, 1.0f, 1.0f));
ts << "[type=PATTERN]"
<< " [bbox=" << patternBoundaries() << "]";
if (!patternTransform().isIdentity())
ts << " [pattern transform=" << patternTransform() << "]";
return ts;
}
}
#endif