Bug 1429298 - Part 4: Rename builder as aBuilder in SVGPathData.cpp. r=TYLin
☠☠ backed out by e03480382807 ☠ ☠
authorBoris Chiou <boris.chiou@gmail.com>
Wed, 22 Aug 2018 01:21:06 +0000
changeset 487842 196fc7b48b84303aaf9b6d8354d3ea9ff9fe5ef0
parent 487841 761e9bb54adbc9f8164a5d83c8d9483b93e8f1fb
child 487843 c217209a3b0494d4c4e6718aa6474221681aa660
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersTYLin
bugs1429298
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1429298 - Part 4: Rename builder as aBuilder in SVGPathData.cpp. r=TYLin Follow the rule of naming for the function parameters. Depends on D2966 Differential Revision: https://phabricator.services.mozilla.com/D3922
dom/svg/SVGPathData.cpp
--- a/dom/svg/SVGPathData.cpp
+++ b/dom/svg/SVGPathData.cpp
@@ -257,28 +257,28 @@ ApproximateZeroLengthSubpathSquareCaps(P
   // described in the comment above.
 
   Float tinyLength = aStrokeWidth / SVG_ZERO_LENGTH_PATH_FIX_FACTOR;
 
   aPB->LineTo(aPoint + Point(tinyLength, 0));
   aPB->MoveTo(aPoint);
 }
 
-#define MAYBE_APPROXIMATE_ZERO_LENGTH_SUBPATH_SQUARE_CAPS_TO_DT               \
-  do {                                                                        \
-    if (!subpathHasLength && hasLineCaps && aStrokeWidth > 0 &&               \
-        subpathContainsNonMoveTo &&                                           \
-        SVGPathSegUtils::IsValidType(prevSegType) &&                          \
-        (!IsMoveto(prevSegType) || segType == PATHSEG_CLOSEPATH)) {           \
-      ApproximateZeroLengthSubpathSquareCaps(builder, segStart, aStrokeWidth);\
-    }                                                                         \
+#define MAYBE_APPROXIMATE_ZERO_LENGTH_SUBPATH_SQUARE_CAPS_TO_DT                \
+  do {                                                                         \
+    if (!subpathHasLength && hasLineCaps && aStrokeWidth > 0 &&                \
+        subpathContainsNonMoveTo &&                                            \
+        SVGPathSegUtils::IsValidType(prevSegType) &&                           \
+        (!IsMoveto(prevSegType) || segType == PATHSEG_CLOSEPATH)) {            \
+      ApproximateZeroLengthSubpathSquareCaps(aBuilder, segStart, aStrokeWidth);\
+    }                                                                          \
   } while(0)
 
 already_AddRefed<Path>
-SVGPathData::BuildPath(PathBuilder* builder,
+SVGPathData::BuildPath(PathBuilder* aBuilder,
                        uint8_t aStrokeLineCap,
                        Float aStrokeWidth) const
 {
   if (mData.IsEmpty() || !IsMoveto(SVGPathSegUtils::DecodeType(mData[0]))) {
     return nullptr; // paths without an initial moveto are invalid
   }
 
   bool hasLineCaps = aStrokeLineCap != NS_STYLE_STROKE_LINECAP_BUTT;
@@ -304,189 +304,189 @@ SVGPathData::BuildPath(PathBuilder* buil
 
     switch (segType)
     {
     case PATHSEG_CLOSEPATH:
       // set this early to allow drawing of square caps for "M{x},{y} Z":
       subpathContainsNonMoveTo = true;
       MAYBE_APPROXIMATE_ZERO_LENGTH_SUBPATH_SQUARE_CAPS_TO_DT;
       segEnd = pathStart;
-      builder->Close();
+      aBuilder->Close();
       break;
 
     case PATHSEG_MOVETO_ABS:
       MAYBE_APPROXIMATE_ZERO_LENGTH_SUBPATH_SQUARE_CAPS_TO_DT;
       pathStart = segEnd = Point(mData[i], mData[i+1]);
-      builder->MoveTo(segEnd);
+      aBuilder->MoveTo(segEnd);
       subpathHasLength = false;
       break;
 
     case PATHSEG_MOVETO_REL:
       MAYBE_APPROXIMATE_ZERO_LENGTH_SUBPATH_SQUARE_CAPS_TO_DT;
       pathStart = segEnd = segStart + Point(mData[i], mData[i+1]);
-      builder->MoveTo(segEnd);
+      aBuilder->MoveTo(segEnd);
       subpathHasLength = false;
       break;
 
     case PATHSEG_LINETO_ABS:
       segEnd = Point(mData[i], mData[i+1]);
       if (segEnd != segStart) {
         subpathHasLength = true;
-        builder->LineTo(segEnd);
+        aBuilder->LineTo(segEnd);
       }
       break;
 
     case PATHSEG_LINETO_REL:
       segEnd = segStart + Point(mData[i], mData[i+1]);
       if (segEnd != segStart) {
         subpathHasLength = true;
-        builder->LineTo(segEnd);
+        aBuilder->LineTo(segEnd);
       }
       break;
 
     case PATHSEG_CURVETO_CUBIC_ABS:
       cp1 = Point(mData[i], mData[i+1]);
       cp2 = Point(mData[i+2], mData[i+3]);
       segEnd = Point(mData[i+4], mData[i+5]);
       if (segEnd != segStart || segEnd != cp1 || segEnd != cp2) {
         subpathHasLength = true;
-        builder->BezierTo(cp1, cp2, segEnd);
+        aBuilder->BezierTo(cp1, cp2, segEnd);
       }
       break;
 
     case PATHSEG_CURVETO_CUBIC_REL:
       cp1 = segStart + Point(mData[i], mData[i+1]);
       cp2 = segStart + Point(mData[i+2], mData[i+3]);
       segEnd = segStart + Point(mData[i+4], mData[i+5]);
       if (segEnd != segStart || segEnd != cp1 || segEnd != cp2) {
         subpathHasLength = true;
-        builder->BezierTo(cp1, cp2, segEnd);
+        aBuilder->BezierTo(cp1, cp2, segEnd);
       }
       break;
 
     case PATHSEG_CURVETO_QUADRATIC_ABS:
       cp1 = Point(mData[i], mData[i+1]);
       // Convert quadratic curve to cubic curve:
       tcp1 = segStart + (cp1 - segStart) * 2 / 3;
       segEnd = Point(mData[i+2], mData[i+3]); // set before setting tcp2!
       tcp2 = cp1 + (segEnd - cp1) / 3;
       if (segEnd != segStart || segEnd != cp1) {
         subpathHasLength = true;
-        builder->BezierTo(tcp1, tcp2, segEnd);
+        aBuilder->BezierTo(tcp1, tcp2, segEnd);
       }
       break;
 
     case PATHSEG_CURVETO_QUADRATIC_REL:
       cp1 = segStart + Point(mData[i], mData[i+1]);
       // Convert quadratic curve to cubic curve:
       tcp1 = segStart + (cp1 - segStart) * 2 / 3;
       segEnd = segStart + Point(mData[i+2], mData[i+3]); // set before setting tcp2!
       tcp2 = cp1 + (segEnd - cp1) / 3;
       if (segEnd != segStart || segEnd != cp1) {
         subpathHasLength = true;
-        builder->BezierTo(tcp1, tcp2, segEnd);
+        aBuilder->BezierTo(tcp1, tcp2, segEnd);
       }
       break;
 
     case PATHSEG_ARC_ABS:
     case PATHSEG_ARC_REL:
     {
       Point radii(mData[i], mData[i+1]);
       segEnd = Point(mData[i+5], mData[i+6]);
       if (segType == PATHSEG_ARC_REL) {
         segEnd += segStart;
       }
       if (segEnd != segStart) {
         subpathHasLength = true;
         if (radii.x == 0.0f || radii.y == 0.0f) {
-          builder->LineTo(segEnd);
+          aBuilder->LineTo(segEnd);
         } else {
           nsSVGArcConverter converter(segStart, segEnd, radii, mData[i+2],
                                       mData[i+3] != 0, mData[i+4] != 0);
           while (converter.GetNextSegment(&cp1, &cp2, &segEnd)) {
-            builder->BezierTo(cp1, cp2, segEnd);
+            aBuilder->BezierTo(cp1, cp2, segEnd);
           }
         }
       }
       break;
     }
 
     case PATHSEG_LINETO_HORIZONTAL_ABS:
       segEnd = Point(mData[i], segStart.y);
       if (segEnd != segStart) {
         subpathHasLength = true;
-        builder->LineTo(segEnd);
+        aBuilder->LineTo(segEnd);
       }
       break;
 
     case PATHSEG_LINETO_HORIZONTAL_REL:
       segEnd = segStart + Point(mData[i], 0.0f);
       if (segEnd != segStart) {
         subpathHasLength = true;
-        builder->LineTo(segEnd);
+        aBuilder->LineTo(segEnd);
       }
       break;
 
     case PATHSEG_LINETO_VERTICAL_ABS:
       segEnd = Point(segStart.x, mData[i]);
       if (segEnd != segStart) {
         subpathHasLength = true;
-        builder->LineTo(segEnd);
+        aBuilder->LineTo(segEnd);
       }
       break;
 
     case PATHSEG_LINETO_VERTICAL_REL:
       segEnd = segStart + Point(0.0f, mData[i]);
       if (segEnd != segStart) {
         subpathHasLength = true;
-        builder->LineTo(segEnd);
+        aBuilder->LineTo(segEnd);
       }
       break;
 
     case PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
       cp1 = SVGPathSegUtils::IsCubicType(prevSegType) ? segStart * 2 - cp2 : segStart;
       cp2 = Point(mData[i],   mData[i+1]);
       segEnd = Point(mData[i+2], mData[i+3]);
       if (segEnd != segStart || segEnd != cp1 || segEnd != cp2) {
         subpathHasLength = true;
-        builder->BezierTo(cp1, cp2, segEnd);
+        aBuilder->BezierTo(cp1, cp2, segEnd);
       }
       break;
 
     case PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
       cp1 = SVGPathSegUtils::IsCubicType(prevSegType) ? segStart * 2 - cp2 : segStart;
       cp2 = segStart + Point(mData[i], mData[i+1]);
       segEnd = segStart + Point(mData[i+2], mData[i+3]);
       if (segEnd != segStart || segEnd != cp1 || segEnd != cp2) {
         subpathHasLength = true;
-        builder->BezierTo(cp1, cp2, segEnd);
+        aBuilder->BezierTo(cp1, cp2, segEnd);
       }
       break;
 
     case PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
       cp1 = SVGPathSegUtils::IsQuadraticType(prevSegType) ? segStart * 2 - cp1 : segStart;
       // Convert quadratic curve to cubic curve:
       tcp1 = segStart + (cp1 - segStart) * 2 / 3;
       segEnd = Point(mData[i], mData[i+1]); // set before setting tcp2!
       tcp2 = cp1 + (segEnd - cp1) / 3;
       if (segEnd != segStart || segEnd != cp1) {
         subpathHasLength = true;
-        builder->BezierTo(tcp1, tcp2, segEnd);
+        aBuilder->BezierTo(tcp1, tcp2, segEnd);
       }
       break;
 
     case PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
       cp1 = SVGPathSegUtils::IsQuadraticType(prevSegType) ? segStart * 2 - cp1 : segStart;
       // Convert quadratic curve to cubic curve:
       tcp1 = segStart + (cp1 - segStart) * 2 / 3;
       segEnd = segStart + Point(mData[i], mData[i+1]); // changed before setting tcp2!
       tcp2 = cp1 + (segEnd - cp1) / 3;
       if (segEnd != segStart || segEnd != cp1) {
         subpathHasLength = true;
-        builder->BezierTo(tcp1, tcp2, segEnd);
+        aBuilder->BezierTo(tcp1, tcp2, segEnd);
       }
       break;
 
     default:
       MOZ_ASSERT_UNREACHABLE("Bad path segment type");
       return nullptr; // according to spec we'd use everything up to the bad seg anyway
     }
 
@@ -498,17 +498,17 @@ SVGPathData::BuildPath(PathBuilder* buil
   }
 
   MOZ_ASSERT(i == mData.Length(), "Very, very bad - mData corrupt");
   MOZ_ASSERT(prevSegType == segType,
              "prevSegType should be left at the final segType");
 
   MAYBE_APPROXIMATE_ZERO_LENGTH_SUBPATH_SQUARE_CAPS_TO_DT;
 
-  return builder->Finish();
+  return aBuilder->Finish();
 }
 
 already_AddRefed<Path>
 SVGPathData::BuildPathForMeasuring() const
 {
   // Since the path that we return will not be used for painting it doesn't
   // matter what we pass to CreatePathBuilder as aFillRule. Hawever, we do want
   // to pass something other than NS_STYLE_STROKE_LINECAP_SQUARE as