Bug 931996 - Add an AppendEllipseToPath helper to Moz2D. r=Bas
☠☠ backed out by c4f51fe7d637 ☠ ☠
authorJonathan Watt <jwatt@jwatt.org>
Fri, 01 Nov 2013 13:30:00 +0000
changeset 153045 0fdae4f78c1a9f6684caa0b6515820c05a17756f
parent 153044 9eeddb8dc3838ee66ecd33b92deaa285a8de042e
child 153046 0dd10890c2409291bf726fdb4e5291bd5fe22f73
push id35673
push userjwatt@jwatt.org
push dateFri, 01 Nov 2013 13:35:20 +0000
treeherdermozilla-inbound@0fdae4f78c1a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs931996
milestone28.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 931996 - Add an AppendEllipseToPath helper to Moz2D. r=Bas
gfx/2d/PathHelpers.cpp
gfx/2d/PathHelpers.h
--- a/gfx/2d/PathHelpers.cpp
+++ b/gfx/2d/PathHelpers.cpp
@@ -145,11 +145,23 @@ AppendRoundedRectToPath(PathBuilder* aPa
     } else {
       aPathBuilder->LineTo(pc);
     }
   }
 
   aPathBuilder->Close();
 }
 
+void
+AppendEllipseToPath(PathBuilder* aPathBuilder,
+                    const Point& aCenter,
+                    const Size& aDimensions)
+{
+  Size halfDim = aDimensions / 2.0;
+  Rect rect(aCenter - Point(halfDim.width, halfDim.height), aDimensions);
+  Size radii[] = { halfDim, halfDim, halfDim, halfDim };
+
+  AppendRoundedRectToPath(aPathBuilder, rect, radii);
+}
+
 } // namespace gfx
 } // namespace mozilla
 
--- a/gfx/2d/PathHelpers.h
+++ b/gfx/2d/PathHelpers.h
@@ -94,12 +94,23 @@ void ArcToBezier(T* aSink, const Point &
  *                 clockwise.
  */
 void AppendRoundedRectToPath(PathBuilder* aPathBuilder,
                              const Rect& aRect,
                              // paren's needed due to operator precedence:
                              const Size(& aCornerRadii)[4],
                              bool aDrawClockwise = true);
 
+/**
+ * Appends a path represending an ellipse to the path being built by
+ * aPathBuilder.
+ *
+ * The ellipse extends aDimensions.width / 2.0 in the horizontal direction
+ * from aCenter, and aDimensions.height / 2.0 in the vertical direction.
+ */
+void AppendEllipseToPath(PathBuilder* aPathBuilder,
+                         const Point& aCenter,
+                         const Size& aDimensions);
+
 } // namespace gfx
 } // namespace mozilla
 
 #endif /* MOZILLA_GFX_PATHHELPERS_H_ */