From 6e98b7b0da0fa7f2c1314a3885397735a28b75d8 Mon Sep 17 00:00:00 2001 From: Ramez Ragaa Date: Fri, 7 Jun 2024 13:57:08 +0300 Subject: [PATCH] fix(surfacebrush): check that the final size isn't empty before resizing images. --- .../Composition/CompositionSurfaceBrush.skia.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Uno.UI.Composition/Composition/CompositionSurfaceBrush.skia.cs b/src/Uno.UI.Composition/Composition/CompositionSurfaceBrush.skia.cs index ebf695d4977d..d14149ac3acb 100644 --- a/src/Uno.UI.Composition/Composition/CompositionSurfaceBrush.skia.cs +++ b/src/Uno.UI.Composition/Composition/CompositionSurfaceBrush.skia.cs @@ -81,6 +81,11 @@ internal override void UpdatePaint(SKPaint fillPaint, SKRect bounds) { var backgroundArea = GetArrangedImageRect(new Size(scs.Image!.Width, scs.Image.Height), bounds); + if (backgroundArea.Width <= 0 || backgroundArea.Height <= 0) + { + return; + } + // Adding image downscaling in the shader matrix directly is very blurry // since the default downsampler in Skia is really low quality (but really fast). // We force Lanczos instead.