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

--HG--
extra : rebase_source : 75592379b93e5574ff1bb4116ce8b90b62c4f8a1
This commit is contained in:
Jonathan Watt 2013-11-01 13:30:00 +00:00
parent 8131d3fc10
commit dbd6cf47e7
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

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