KHTML
SVGPaintServerPattern.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "config.h"
00027
00028 #if ENABLE(SVG)
00029 #include "SVGPaintServerPattern.h"
00030
00031 #include "ImageBuffer.h"
00032 #include "SVGPatternElement.h"
00033 #include "SVGRenderTreeAsText.h"
00034
00035 using namespace std;
00036
00037 namespace WebCore {
00038
00039 SVGPaintServerPattern::SVGPaintServerPattern(const SVGPatternElement* owner)
00040 : m_ownerElement(owner)
00041 #if PLATFORM(CG)
00042 , m_patternSpace(0)
00043 , m_pattern(0)
00044 #endif
00045 {
00046 ASSERT(owner);
00047 }
00048
00049 SVGPaintServerPattern::~SVGPaintServerPattern()
00050 {
00051 #if PLATFORM(CG)
00052 CGPatternRelease(m_pattern);
00053 CGColorSpaceRelease(m_patternSpace);
00054 #endif
00055 }
00056
00057 FloatRect SVGPaintServerPattern::patternBoundaries() const
00058 {
00059 return m_patternBoundaries;
00060 }
00061
00062 void SVGPaintServerPattern::setPatternBoundaries(const FloatRect& rect)
00063 {
00064 m_patternBoundaries = rect;
00065 }
00066
00067 ImageBuffer* SVGPaintServerPattern::tile() const
00068 {
00069 return m_tile.get();
00070 }
00071
00072 void SVGPaintServerPattern::setTile(auto_ptr<ImageBuffer> tile)
00073 {
00074 m_tile.set(tile.release());
00075 }
00076
00077 AffineTransform SVGPaintServerPattern::patternTransform() const
00078 {
00079 return m_patternTransform;
00080 }
00081
00082 void SVGPaintServerPattern::setPatternTransform(const AffineTransform& transform)
00083 {
00084 m_patternTransform = transform;
00085 }
00086
00087 TextStream& SVGPaintServerPattern::externalRepresentation(TextStream& ts) const
00088 {
00089
00090 m_ownerElement->buildPattern(FloatRect(0.0f, 0.0f, 1.0f, 1.0f));
00091
00092 ts << "[type=PATTERN]"
00093 << " [bbox=" << patternBoundaries() << "]";
00094 if (!patternTransform().isIdentity())
00095 ts << " [pattern transform=" << patternTransform() << "]";
00096 return ts;
00097 }
00098
00099 }
00100
00101 #endif