KHTML
SVGResourceClipper.h
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 #ifndef SVGResourceClipper_h
00027 #define SVGResourceClipper_h
00028
00029 #if ENABLE(SVG)
00030
00031 #include "SVGResource.h"
00032 #include "Path.h"
00033
00034
00035 #include "wtf/PassRefPtr.h"
00036
00037 namespace WebCore {
00038
00039 struct ClipData {
00040 Path path;
00041 WindRule windRule;
00042 bool bboxUnits : 1;
00043 };
00044
00045 class ClipDataList {
00046 public:
00047 void addPath(const Path& pathData, WindRule windRule, bool bboxUnits)
00048 {
00049 ClipData clipData;
00050
00051 clipData.path = pathData;
00052 clipData.windRule = windRule;
00053 clipData.bboxUnits = bboxUnits;
00054
00055 m_clipData.append(clipData);
00056 }
00057
00058 void clear() { m_clipData.clear(); }
00059 const Vector<ClipData>& clipData() const { return m_clipData; }
00060 bool isEmpty() const { return m_clipData.isEmpty(); }
00061 private:
00062 Vector<ClipData> m_clipData;
00063 };
00064
00065
00066
00067 class SVGResourceClipper : public SVGResource {
00068 public:
00069 static PassRefPtr<SVGResourceClipper> create() { return adoptRef(new SVGResourceClipper); }
00070 virtual ~SVGResourceClipper();
00071
00072 void resetClipData();
00073 void addClipData(const Path&, WindRule, bool bboxUnits);
00074
00075 const ClipDataList& clipData() const;
00076
00077 virtual SVGResourceType resourceType() const { return ClipperResourceType; }
00078
00079
00080
00081 void applyClip(QPainter* painter, const FloatRect& boundingBox) const;
00082 private:
00083 SVGResourceClipper();
00084 ClipDataList m_clipData;
00085 };
00086
00087
00088
00089
00090 SVGResourceClipper* getClipperById(Document*, const AtomicString&);
00091
00092 }
00093
00094 #endif
00095
00096 #endif // SVGResourceClipper_h