Skip to content

Commit

Permalink
[Android] Border with RoundRectangle (dotnet#21173)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubaflo committed Mar 17, 2024
1 parent 2317119 commit c24d4b3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Core/src/Platform/Android/ContentViewGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,14 @@ internal IBorderStroke? Clip

float density = _context.GetDisplayDensity();
float strokeThickness = (float)Clip.StrokeThickness;
float w = (width / density) - strokeThickness;
float h = (height / density) - strokeThickness;
float x = strokeThickness / 2;
float y = strokeThickness / 2;

// We need to inset the content clipping by the width of the stroke on both sides
// (top and bottom, left and right), so we remove it twice from the total width/height
var strokeInset = 2 * strokeThickness;
float w = (width / density) - strokeInset;
float h = (height / density) - strokeInset;
float x = strokeThickness;
float y = strokeThickness;
IShape clipShape = Clip.Shape;

var bounds = new Graphics.RectF(x, y, w, h);
Expand Down

0 comments on commit c24d4b3

Please sign in to comment.