1 /* 2 Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Library General Public 6 License as published by the Free Software Foundation; either 7 version 2 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Library General Public License for more details. 13 14 You should have received a copy of the GNU Library General Public License 15 aint with this library; see the file COPYING.LIB. If not, write to 16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef SVGMarkerLayoutInfo_h 21 #define SVGMarkerLayoutInfo_h 22 23 #if ENABLE(SVG) 24 #include "RenderObject.h" 25 #include "SVGMarkerData.h" 26 #include <wtf/Noncopyable.h> 27 28 namespace WebCore { 29 30 class Path; 31 class SVGResourceMarker; 32 33 struct MarkerLayout { 34 MarkerLayout(SVGResourceMarker* markerObj = 0, AffineTransform matrixObj = AffineTransform()) 35 : marker(markerObj) 36 , matrix(matrixObj) 37 { 38 ASSERT(marker); 39 } 40 41 SVGResourceMarker* marker; 42 AffineTransform matrix; 43 }; 44 45 class SVGMarkerLayoutInfo : public Noncopyable { 46 public: 47 SVGMarkerLayoutInfo(); 48 ~SVGMarkerLayoutInfo(); 49 50 FloatRect calculateBoundaries(SVGResourceMarker* startMarker, SVGResourceMarker* midMarker, SVGResourceMarker* endMarker, float strokeWidth, const Path&); 51 void drawMarkers(RenderObject::PaintInfo&); 52 53 // Used by static inline helper functions in SVGMarkerLayoutInfo.cpp 54 SVGMarkerData& markerData() { return m_markerData; } 55 SVGResourceMarker* midMarker() const { return m_midMarker; } 56 int& elementIndex() { return m_elementIndex; } 57 void addLayoutedMarker(SVGResourceMarker*, const FloatPoint& origin, float angle); 58 59 private: 60 SVGResourceMarker* m_midMarker; 61 62 // Used while layouting markers 63 int m_elementIndex; 64 SVGMarkerData m_markerData; 65 float m_strokeWidth; 66 67 // Holds the final computed result 68 Vector<MarkerLayout> m_layout; 69 }; 70 71 } 72 73 #endif // ENABLE(SVG) 74 #endif // SVGMarkerLayoutInfo_h 75