Skip to content

Commit

Permalink
[Fixes bug #731439] Use rounding instead of truncation so we correctl…
Browse files Browse the repository at this point in the history
…y calculate the size of a path's bounding box.
  • Loading branch information
jpobst committed Mar 28, 2011
1 parent e31e363 commit 3db0357
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Pinta.Core/Extensions/CairoExtensions.cs
Expand Up @@ -863,7 +863,12 @@ public static Gdk.Rectangle GetBounds (this Path path)
rect = g.StrokeExtents ();
}

return new Gdk.Rectangle ((int)rect.X, (int)rect.Y, (int)rect.Width - (int)rect.X, (int)rect.Height - (int)rect.Y);
int x = (int)Math.Round (rect.X);
int y = (int)Math.Round (rect.Y);
int w = (int)Math.Round (rect.Width);
int h = (int)Math.Round (rect.Height);

return new Gdk.Rectangle (x, y, w - x, h - y);
}

public static Gdk.Color ToGdkColor (this Cairo.Color color)
Expand Down

0 comments on commit 3db0357

Please sign in to comment.