Bug 931996 - Add an AppendEllipseToPath helper to Moz2D. r=Bas

This commit is contained in:
Jonathan Watt 2013-11-01 13:30:00 +00:00
parent ab8c22c592
commit 284d89f828
2 changed files with 23 additions and 0 deletions

View File

@ -150,6 +150,18 @@ AppendRoundedRectToPath(PathBuilder* aPathBuilder,
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

View File

@ -98,6 +98,17 @@ GFX2D_API void AppendRoundedRectToPath(PathBuilder* aPathBuilder,
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.
*/
GFX2D_API void AppendEllipseToPath(PathBuilder* aPathBuilder,
const Point& aCenter,
const Size& aDimensions);
} // namespace gfx
} // namespace mozilla