Title: [138800] trunk/Source/WebCore
- Revision
- 138800
- Author
- [email protected]
- Date
- 2013-01-04 08:14:10 -0800 (Fri, 04 Jan 2013)
Log Message
Add 'float FloatPoint::slopeAngleRadians()'
https://bugs.webkit.org/show_bug.cgi?id=105997
Patch by Steve Block <[email protected]> on 2013-01-04
Reviewed by Stephen White.
Refactoring only, no functional change.
* platform/graphics/FloatPoint.cpp:
(WebCore::FloatPoint::slopeAngleRadians):
(WebCore):
* platform/graphics/FloatPoint.h:
Add 'float FloatPoint::slopeAngleRadians() const'
* platform/graphics/PathTraversalState.cpp:
(WebCore::PathTraversalState::processSegment):
* rendering/svg/SVGMarkerData.h:
(WebCore::SVGMarkerData::currentAngle):
* svg/SVGPathParser.cpp:
(WebCore::SVGPathParser::decomposeArcToCubic):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (138799 => 138800)
--- trunk/Source/WebCore/ChangeLog 2013-01-04 15:55:18 UTC (rev 138799)
+++ trunk/Source/WebCore/ChangeLog 2013-01-04 16:14:10 UTC (rev 138800)
@@ -1,3 +1,24 @@
+2013-01-04 Steve Block <[email protected]>
+
+ Add 'float FloatPoint::slopeAngleRadians()'
+ https://bugs.webkit.org/show_bug.cgi?id=105997
+
+ Reviewed by Stephen White.
+
+ Refactoring only, no functional change.
+
+ * platform/graphics/FloatPoint.cpp:
+ (WebCore::FloatPoint::slopeAngleRadians):
+ (WebCore):
+ * platform/graphics/FloatPoint.h:
+ Add 'float FloatPoint::slopeAngleRadians() const'
+ * platform/graphics/PathTraversalState.cpp:
+ (WebCore::PathTraversalState::processSegment):
+ * rendering/svg/SVGMarkerData.h:
+ (WebCore::SVGMarkerData::currentAngle):
+ * svg/SVGPathParser.cpp:
+ (WebCore::SVGPathParser::decomposeArcToCubic):
+
2013-01-04 Zan Dobersek <[email protected]>
REGRESSION (r138184): transitions/transitions-parsing.html is failing on GTK
Modified: trunk/Source/WebCore/platform/graphics/FloatPoint.cpp (138799 => 138800)
--- trunk/Source/WebCore/platform/graphics/FloatPoint.cpp 2013-01-04 15:55:18 UTC (rev 138799)
+++ trunk/Source/WebCore/platform/graphics/FloatPoint.cpp 2013-01-04 16:14:10 UTC (rev 138800)
@@ -56,6 +56,11 @@
}
}
+float FloatPoint::slopeAngleRadians() const
+{
+ return atan2f(m_y, m_x);
+}
+
float FloatPoint::length() const
{
return sqrtf(lengthSquared());
Modified: trunk/Source/WebCore/platform/graphics/FloatPoint.h (138799 => 138800)
--- trunk/Source/WebCore/platform/graphics/FloatPoint.h 2013-01-04 15:55:18 UTC (rev 138799)
+++ trunk/Source/WebCore/platform/graphics/FloatPoint.h 2013-01-04 16:14:10 UTC (rev 138800)
@@ -133,6 +133,7 @@
return m_x * a.x() + m_y * a.y();
}
+ float slopeAngleRadians() const;
float length() const;
float lengthSquared() const
{
Modified: trunk/Source/WebCore/platform/graphics/PathTraversalState.cpp (138799 => 138800)
--- trunk/Source/WebCore/platform/graphics/PathTraversalState.cpp 2013-01-04 15:55:18 UTC (rev 138799)
+++ trunk/Source/WebCore/platform/graphics/PathTraversalState.cpp 2013-01-04 16:14:10 UTC (rev 138800)
@@ -209,8 +209,7 @@
m_success = true;
if ((m_action == TraversalPointAtLength || m_action == TraversalNormalAngleAtLength) && m_totalLength >= m_desiredLength) {
- FloatSize change = m_current - m_previous;
- float slope = atan2f(change.height(), change.width());
+ float slope = FloatPoint(m_current - m_previous).slopeAngleRadians();
if (m_action == TraversalPointAtLength) {
float offset = m_desiredLength - m_totalLength;
m_current.move(offset * cosf(slope), offset * sinf(slope));
Modified: trunk/Source/WebCore/rendering/svg/SVGMarkerData.h (138799 => 138800)
--- trunk/Source/WebCore/rendering/svg/SVGMarkerData.h 2013-01-04 15:55:18 UTC (rev 138799)
+++ trunk/Source/WebCore/rendering/svg/SVGMarkerData.h 2013-01-04 16:14:10 UTC (rev 138800)
@@ -82,11 +82,11 @@
private:
float currentAngle(SVGMarkerType type) const
{
- FloatSize inslopeChange = m_inslopePoints[1] - m_inslopePoints[0];
- FloatSize outslopeChange = m_outslopePoints[1] - m_outslopePoints[0];
+ FloatPoint inslopeChange(m_inslopePoints[1] - m_inslopePoints[0]);
+ FloatPoint outslopeChange(m_outslopePoints[1] - m_outslopePoints[0]);
- double inslope = rad2deg(atan2(inslopeChange.height(), inslopeChange.width()));
- double outslope = rad2deg(atan2(outslopeChange.height(), outslopeChange.width()));
+ double inslope = rad2deg(inslopeChange.slopeAngleRadians());
+ double outslope = rad2deg(outslopeChange.slopeAngleRadians());
switch (type) {
case StartMarker:
Modified: trunk/Source/WebCore/svg/SVGPathParser.cpp (138799 => 138800)
--- trunk/Source/WebCore/svg/SVGPathParser.cpp 2013-01-04 15:55:18 UTC (rev 138799)
+++ trunk/Source/WebCore/svg/SVGPathParser.cpp 2013-01-04 16:14:10 UTC (rev 138800)
@@ -448,11 +448,12 @@
scaleFactor = -scaleFactor;
delta.scale(scaleFactor);
- FloatPoint centerPoint = FloatPoint(0.5f * (point1.x() + point2.x()) - delta.height(),
- 0.5f * (point1.y() + point2.y()) + delta.width());
+ FloatPoint centerPoint = point1 + point2;
+ centerPoint.scale(0.5f, 0.5f);
+ centerPoint.move(-delta.height(), delta.width());
- float theta1 = atan2f(point1.y() - centerPoint.y(), point1.x() - centerPoint.x());
- float theta2 = atan2f(point2.y() - centerPoint.y(), point2.x() - centerPoint.x());
+ float theta1 = FloatPoint(point1 - centerPoint).slopeAngleRadians();
+ float theta2 = FloatPoint(point2 - centerPoint).slopeAngleRadians();
float thetaArc = theta2 - theta1;
if (thetaArc < 0 && sweepFlag)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes