diff --git a/Perspex.Controls/Border.cs b/Perspex.Controls/Border.cs index 133e2c63eb..b22a22c37f 100644 --- a/Perspex.Controls/Border.cs +++ b/Perspex.Controls/Border.cs @@ -51,7 +51,7 @@ namespace Perspex.Controls Brush background = this.Background; Brush borderBrush = this.BorderBrush; double borderThickness = this.BorderThickness; - Rect rect = new Rect(this.Bounds.Size).Deflate(this.BorderThickness / 2); + Rect rect = new Rect(this.Bounds.Size).Deflate(this.BorderThickness); if (background != null) { diff --git a/Perspex.Controls/Shapes/Ellipse.cs b/Perspex.Controls/Shapes/Ellipse.cs index bec10c30ea..740f5b0561 100644 --- a/Perspex.Controls/Shapes/Ellipse.cs +++ b/Perspex.Controls/Shapes/Ellipse.cs @@ -20,8 +20,7 @@ namespace Perspex.Controls.Shapes { if (this.geometry == null || this.geometrySize != this.Bounds.Size) { - var rect = new Rect(0, 0, this.Bounds.Size.Width, this.Bounds.Size.Height); - rect = rect.Deflate(this.StrokeThickness / 2); + var rect = new Rect(this.Bounds.Size).Deflate(this.StrokeThickness); this.geometry = new EllipseGeometry(rect); this.geometrySize = this.Bounds.Size; } diff --git a/Perspex.Controls/Shapes/Rectangle.cs b/Perspex.Controls/Shapes/Rectangle.cs index 8bdc2589e8..4e34ba2d8b 100644 --- a/Perspex.Controls/Shapes/Rectangle.cs +++ b/Perspex.Controls/Shapes/Rectangle.cs @@ -20,7 +20,8 @@ namespace Perspex.Controls.Shapes { if (this.geometry == null || this.geometrySize != this.Bounds.Size) { - this.geometry = new RectangleGeometry(new Rect(0, 0, this.Bounds.Size.Width, this.Bounds.Size.Height)); + var rect = new Rect(this.Bounds.Size).Deflate(this.StrokeThickness); + this.geometry = new RectangleGeometry(rect); this.geometrySize = this.Bounds.Size; } diff --git a/Perspex.SceneGraph/Rect.cs b/Perspex.SceneGraph/Rect.cs index 5a0268ab9c..38eae3bd24 100644 --- a/Perspex.SceneGraph/Rect.cs +++ b/Perspex.SceneGraph/Rect.cs @@ -302,7 +302,7 @@ namespace Perspex /// The deflated rectangle size cannot be less than 0. public Rect Deflate(double thickness) { - return this.Deflate(new Thickness(thickness)); + return this.Deflate(new Thickness(thickness / 2)); } /// diff --git a/TestFiles/Direct2D1/Shapes/Rectangle/Rectangle_1px_Stroke.expected.png b/TestFiles/Direct2D1/Shapes/Rectangle/Rectangle_1px_Stroke.expected.png index 6aa013a894..24239d5799 100644 Binary files a/TestFiles/Direct2D1/Shapes/Rectangle/Rectangle_1px_Stroke.expected.png and b/TestFiles/Direct2D1/Shapes/Rectangle/Rectangle_1px_Stroke.expected.png differ