Skip to content

Commit

Permalink
[Android] Fix shadows size in clipped views (dotnet#11603) Fixes dotn…
Browse files Browse the repository at this point in the history
…et#11578

* Fix shadows clipping views

* Fix build errors

* Capture and cache Context usage

We've found Context can be a bit expensive to get in a large frequency of calls (dotnet#8001), so we can avoid this by capturing and caching the instance.

* Removed duplicated test

* Revert latest changes

---------

Co-authored-by: redth <jondick@gmail.com>
Co-authored-by: Rachel Kang <rachelkang@microsoft.com>
  • Loading branch information
3 people authored and TJ Lambert committed Feb 21, 2023
1 parent 4eb8210 commit f7b9729
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Core/src/Platform/Android/WrapperView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ void DrawShadow(Canvas canvas)
else
{
var bounds = new Graphics.RectF(0, 0, canvas.Width, canvas.Height);
var path = Clip.PathForBounds(bounds)?.AsAndroidPath();
var density = Context.GetDisplayDensity();
var path = Clip.PathForBounds(bounds)?.AsAndroidPath(scaleX: density, scaleY: density);

path.Offset(shadowOffsetX, shadowOffsetY);

Expand Down

0 comments on commit f7b9729

Please sign in to comment.