Commit cb0f1799 authored by fs's avatar fs Committed by Commit bot

Cleanup SVGMarkerData::updateFromPathElement

Make the updateFromPathElement "closure" a simple thunk-style function,
to make it a little less unwieldy. Also pass PathElement& rather than
PathElement*.

BUG=633012,450368

Review-Url: https://codereview.chromium.org/2540513005
Cr-Commit-Position: refs/heads/master@{#434987}
parent e8df8fe6
...@@ -52,23 +52,7 @@ class SVGMarkerData { ...@@ -52,23 +52,7 @@ class SVGMarkerData {
m_autoStartReverse(autoStartReverse) {} m_autoStartReverse(autoStartReverse) {}
static void updateFromPathElement(void* info, const PathElement* element) { static void updateFromPathElement(void* info, const PathElement* element) {
SVGMarkerData* markerData = static_cast<SVGMarkerData*>(info); static_cast<SVGMarkerData*>(info)->updateFromPathElement(*element);
// First update the outslope for the previous element.
markerData->updateOutslope(element->points[0]);
// Record the marker for the previous element.
if (markerData->m_elementIndex > 0) {
SVGMarkerType markerType =
markerData->m_elementIndex == 1 ? StartMarker : MidMarker;
markerData->m_positions.append(
MarkerPosition(markerType, markerData->m_origin,
markerData->currentAngle(markerType)));
}
// Update our marker data for this element.
markerData->updateMarkerDataForPathElement(element);
++markerData->m_elementIndex;
} }
void pathIsDone() { void pathIsDone() {
...@@ -127,10 +111,26 @@ class SVGMarkerData { ...@@ -127,10 +111,26 @@ class SVGMarkerData {
m_outslopePoints[1] = point; m_outslopePoints[1] = point;
} }
void updateMarkerDataForPathElement(const PathElement* element) { void updateFromPathElement(const PathElement& element) {
FloatPoint* points = element->points; // First update the outslope for the previous element.
updateOutslope(element.points[0]);
// Record the marker for the previous element.
if (m_elementIndex > 0) {
SVGMarkerType markerType = m_elementIndex == 1 ? StartMarker : MidMarker;
m_positions.append(
MarkerPosition(markerType, m_origin, currentAngle(markerType)));
}
// Update our marker data for this element.
updateMarkerDataForPathElement(element);
++m_elementIndex;
}
void updateMarkerDataForPathElement(const PathElement& element) {
const FloatPoint* points = element.points;
switch (element->type) { switch (element.type) {
case PathElementAddQuadCurveToPoint: case PathElementAddQuadCurveToPoint:
m_inslopePoints[0] = points[0]; m_inslopePoints[0] = points[0];
m_inslopePoints[1] = points[1]; m_inslopePoints[1] = points[1];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment