diff --git a/source/FFImageLoading.Common/Work/TaskParameter.cs b/source/FFImageLoading.Common/Work/TaskParameter.cs index cca00adbe..7e61b49c9 100644 --- a/source/FFImageLoading.Common/Work/TaskParameter.cs +++ b/source/FFImageLoading.Common/Work/TaskParameter.cs @@ -272,7 +272,8 @@ public TaskParameter ErrorPlaceholder(string filepath, ImageSource source = Imag public TaskParameter DownSample(int width = 0, int height = 0, bool? allowUpscale = null) { DownSampleUseDipUnits = false; - + width = Math.Max(0, width); + height = Math.Max(0, height); DownSampleSize = Tuple.Create(width, width > 0 ? 0 : height); AllowUpscale = allowUpscale; @@ -291,7 +292,9 @@ public TaskParameter DownSample(int width = 0, int height = 0, bool? allowUpscal public TaskParameter DownSampleInDip(int width = 0, int height = 0, bool? allowUpscale = null) { DownSampleUseDipUnits = true; - DownSampleSize = Tuple.Create(width, width > 0 ? 0 : height); + width = Math.Max(0, width); + height = Math.Max(0, height); + DownSampleSize = Tuple.Create(width, width > 0 ? 0 : height); AllowUpscale = allowUpscale; return this;