cairo: Fix rectangles returned by StrokeExtents and FillExtents methods

The third and fourth parameters of the Rectangle constructor are width
and height, but cairo_stroke_extents and cairo_fill_extents give right
and bottom coordinates.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
This commit is contained in:
Cameron White 2012-12-23 14:10:51 -05:00 committed by Bertrand Lorentz
parent 629a34aa4f
commit 57c82a89c7

View File

@ -578,7 +578,7 @@ namespace Cairo {
{ {
double x1, y1, x2, y2; double x1, y1, x2, y2;
NativeMethods.cairo_stroke_extents (state, out x1, out y1, out x2, out y2); NativeMethods.cairo_stroke_extents (state, out x1, out y1, out x2, out y2);
return new Rectangle (x1, y1, x2, y2); return new Rectangle (x1, y1, x2 - x1, y2 - y1);
} }
public void Fill () public void Fill ()
@ -590,7 +590,7 @@ namespace Cairo {
{ {
double x1, y1, x2, y2; double x1, y1, x2, y2;
NativeMethods.cairo_fill_extents (state, out x1, out y1, out x2, out y2); NativeMethods.cairo_fill_extents (state, out x1, out y1, out x2, out y2);
return new Rectangle (x1, y1, x2, y2); return new Rectangle (x1, y1, x2 - x1, y2 - y1);
} }
public void FillPreserve () public void FillPreserve ()