| 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
| 15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
| 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
| 18 */ | 18 */ |
| 19 | 19 |
| 20 #ifndef SVGMarkerData_h | 20 #ifndef SVGMarkerData_h |
| 21 #define SVGMarkerData_h | 21 #define SVGMarkerData_h |
| 22 | 22 |
| 23 #include "platform/FloatConversion.h" | |
| 24 #include "platform/graphics/Path.h" | 23 #include "platform/graphics/Path.h" |
| 25 #include "wtf/Allocator.h" | 24 #include "wtf/Allocator.h" |
| 26 #include "wtf/MathExtras.h" | 25 #include "wtf/MathExtras.h" |
| 27 | 26 |
| 28 namespace blink { | 27 namespace blink { |
| 29 | 28 |
| 30 enum SVGMarkerType { | 29 enum SVGMarkerType { |
| 31 StartMarker, | 30 StartMarker, |
| 32 MidMarker, | 31 MidMarker, |
| 33 EndMarker | 32 EndMarker |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 FloatPoint inSlope(m_inslopePoints[1] - m_inslopePoints[0]); | 103 FloatPoint inSlope(m_inslopePoints[1] - m_inslopePoints[0]); |
| 105 FloatPoint outSlope(m_outslopePoints[1] - m_outslopePoints[0]); | 104 FloatPoint outSlope(m_outslopePoints[1] - m_outslopePoints[0]); |
| 106 | 105 |
| 107 double inAngle = rad2deg(inSlope.slopeAngleRadians()); | 106 double inAngle = rad2deg(inSlope.slopeAngleRadians()); |
| 108 double outAngle = rad2deg(outSlope.slopeAngleRadians()); | 107 double outAngle = rad2deg(outSlope.slopeAngleRadians()); |
| 109 | 108 |
| 110 switch (type) { | 109 switch (type) { |
| 111 case StartMarker: | 110 case StartMarker: |
| 112 if (m_autoStartReverse) | 111 if (m_autoStartReverse) |
| 113 outAngle += 180; | 112 outAngle += 180; |
| 114 return narrowPrecisionToFloat(outAngle); | 113 return clampTo<float>(outAngle); |
| 115 case MidMarker: | 114 case MidMarker: |
| 116 // WK193015: Prevent bugs due to angles being non-continuous. | 115 // WK193015: Prevent bugs due to angles being non-continuous. |
| 117 if (fabs(inAngle - outAngle) > 180) | 116 if (fabs(inAngle - outAngle) > 180) |
| 118 inAngle += 360; | 117 inAngle += 360; |
| 119 return narrowPrecisionToFloat((inAngle + outAngle) / 2); | 118 return clampTo<float>((inAngle + outAngle) / 2); |
| 120 case EndMarker: | 119 case EndMarker: |
| 121 return narrowPrecisionToFloat(inAngle); | 120 return clampTo<float>(inAngle); |
| 122 } | 121 } |
| 123 | 122 |
| 124 ASSERT_NOT_REACHED(); | 123 ASSERT_NOT_REACHED(); |
| 125 return 0; | 124 return 0; |
| 126 } | 125 } |
| 127 | 126 |
| 128 void updateOutslope(const FloatPoint& point) | 127 void updateOutslope(const FloatPoint& point) |
| 129 { | 128 { |
| 130 m_outslopePoints[0] = m_origin; | 129 m_outslopePoints[0] = m_origin; |
| 131 m_outslopePoints[1] = point; | 130 m_outslopePoints[1] = point; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 FloatPoint m_origin; | 169 FloatPoint m_origin; |
| 171 FloatPoint m_subpathStart; | 170 FloatPoint m_subpathStart; |
| 172 FloatPoint m_inslopePoints[2]; | 171 FloatPoint m_inslopePoints[2]; |
| 173 FloatPoint m_outslopePoints[2]; | 172 FloatPoint m_outslopePoints[2]; |
| 174 bool m_autoStartReverse; | 173 bool m_autoStartReverse; |
| 175 }; | 174 }; |
| 176 | 175 |
| 177 } // namespace blink | 176 } // namespace blink |
| 178 | 177 |
| 179 #endif // SVGMarkerData_h | 178 #endif // SVGMarkerData_h |
| OLD | NEW |