| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 , origin(useOrigin) | 38 , origin(useOrigin) |
| 39 , angle(useAngle) | 39 , angle(useAngle) |
| 40 { | 40 { |
| 41 } | 41 } |
| 42 | 42 |
| 43 SVGMarkerType type; | 43 SVGMarkerType type; |
| 44 FloatPoint origin; | 44 FloatPoint origin; |
| 45 float angle; | 45 float angle; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 class RenderSVGResourceMarker; |
| 49 |
| 48 class SVGMarkerData { | 50 class SVGMarkerData { |
| 49 public: | 51 public: |
| 50 SVGMarkerData(Vector<MarkerPosition>& positions, bool autoStartReverse) | 52 SVGMarkerData(Vector<MarkerPosition>& positions, bool autoStartReverse) |
| 51 : m_positions(positions) | 53 : m_positions(positions) |
| 52 , m_elementIndex(0) | 54 , m_elementIndex(0) |
| 53 , m_autoStartReverse(autoStartReverse) | 55 , m_autoStartReverse(autoStartReverse) |
| 54 { | 56 { |
| 55 } | 57 } |
| 56 | 58 |
| 57 static void updateFromPathElement(void* info, const PathElement* element) | 59 static void updateFromPathElement(void* info, const PathElement* element) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 70 // Update our marker data for this element. | 72 // Update our marker data for this element. |
| 71 markerData->updateMarkerDataForPathElement(element); | 73 markerData->updateMarkerDataForPathElement(element); |
| 72 ++markerData->m_elementIndex; | 74 ++markerData->m_elementIndex; |
| 73 } | 75 } |
| 74 | 76 |
| 75 void pathIsDone() | 77 void pathIsDone() |
| 76 { | 78 { |
| 77 m_positions.append(MarkerPosition(EndMarker, m_origin, currentAngle(EndM
arker))); | 79 m_positions.append(MarkerPosition(EndMarker, m_origin, currentAngle(EndM
arker))); |
| 78 } | 80 } |
| 79 | 81 |
| 82 static inline RenderSVGResourceMarker* markerForType(const SVGMarkerType& ty
pe, RenderSVGResourceMarker* markerStart, RenderSVGResourceMarker* markerMid, Re
nderSVGResourceMarker* markerEnd) |
| 83 { |
| 84 switch (type) { |
| 85 case StartMarker: |
| 86 return markerStart; |
| 87 case MidMarker: |
| 88 return markerMid; |
| 89 case EndMarker: |
| 90 return markerEnd; |
| 91 } |
| 92 |
| 93 ASSERT_NOT_REACHED(); |
| 94 return 0; |
| 95 } |
| 96 |
| 80 private: | 97 private: |
| 81 float currentAngle(SVGMarkerType type) const | 98 float currentAngle(SVGMarkerType type) const |
| 82 { | 99 { |
| 83 // For details of this calculation, see: http://www.w3.org/TR/SVG/single
-page.html#painting-MarkerElement | 100 // For details of this calculation, see: http://www.w3.org/TR/SVG/single
-page.html#painting-MarkerElement |
| 84 FloatPoint inSlope(m_inslopePoints[1] - m_inslopePoints[0]); | 101 FloatPoint inSlope(m_inslopePoints[1] - m_inslopePoints[0]); |
| 85 FloatPoint outSlope(m_outslopePoints[1] - m_outslopePoints[0]); | 102 FloatPoint outSlope(m_outslopePoints[1] - m_outslopePoints[0]); |
| 86 | 103 |
| 87 double inAngle = rad2deg(inSlope.slopeAngleRadians()); | 104 double inAngle = rad2deg(inSlope.slopeAngleRadians()); |
| 88 double outAngle = rad2deg(outSlope.slopeAngleRadians()); | 105 double outAngle = rad2deg(outSlope.slopeAngleRadians()); |
| 89 | 106 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 FloatPoint m_origin; | 166 FloatPoint m_origin; |
| 150 FloatPoint m_subpathStart; | 167 FloatPoint m_subpathStart; |
| 151 FloatPoint m_inslopePoints[2]; | 168 FloatPoint m_inslopePoints[2]; |
| 152 FloatPoint m_outslopePoints[2]; | 169 FloatPoint m_outslopePoints[2]; |
| 153 bool m_autoStartReverse; | 170 bool m_autoStartReverse; |
| 154 }; | 171 }; |
| 155 | 172 |
| 156 } | 173 } |
| 157 | 174 |
| 158 #endif // SVGMarkerData_h | 175 #endif // SVGMarkerData_h |
| OLD | NEW |