Skip to content

Commit fe6b907

Browse files
Update TaskParameter.cs
1 parent 22927e4 commit fe6b907

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

source/FFImageLoading.Common/Work/TaskParameter.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ public TaskParameter ErrorPlaceholder(string filepath, ImageSource source = Imag
272272
public TaskParameter DownSample(int width = 0, int height = 0, bool? allowUpscale = null)
273273
{
274274
DownSampleUseDipUnits = false;
275-
275+
width = Math.Max(0, width);
276+
height = Math.Max(0, height);
276277
DownSampleSize = Tuple.Create(width, width > 0 ? 0 : height);
277278
AllowUpscale = allowUpscale;
278279

@@ -291,7 +292,9 @@ public TaskParameter DownSample(int width = 0, int height = 0, bool? allowUpscal
291292
public TaskParameter DownSampleInDip(int width = 0, int height = 0, bool? allowUpscale = null)
292293
{
293294
DownSampleUseDipUnits = true;
294-
DownSampleSize = Tuple.Create(width, width > 0 ? 0 : height);
295+
width = Math.Max(0, width);
296+
height = Math.Max(0, height);
297+
DownSampleSize = Tuple.Create(width, width > 0 ? 0 : height);
295298
AllowUpscale = allowUpscale;
296299

297300
return this;

0 commit comments

Comments
 (0)