Skip to content

Commit

Permalink
Fix MauiIcon ForegroundScale on systems with comma as decimal separator
Browse files Browse the repository at this point in the history
Fixes #11685

Specifying the ForegroundScale with a dot caused an issue on systems
with commas as decimal separators. The image got upscaled instead of
downscaled on those systems because the ForegroundScale was parsed
without passing InvariantCulture as culture info. Because of this,
it only worked on systems with a dot as a decimal separator.
  • Loading branch information
AndreKraemer authored and github-actions committed Dec 8, 2022
1 parent 01c0c99 commit 0dfd31b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/SingleProject/Resizetizer/src/ResizeImageInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using Microsoft.Build.Framework;
using SkiaSharp;
Expand Down Expand Up @@ -95,7 +96,7 @@ public static List<ResizeImageInfo> Parse(IEnumerable<ITaskItem> images)
if (bool.TryParse(image.GetMetadata("IsAppIcon"), out var iai))
info.IsAppIcon = iai;

if (float.TryParse(image.GetMetadata("ForegroundScale"), out var fsc))
if (float.TryParse(image.GetMetadata("ForegroundScale"), NumberStyles.Number, CultureInfo.InvariantCulture, out var fsc))
info.ForegroundScale = fsc;

var fgFile = image.GetMetadata("ForegroundFile");
Expand Down

0 comments on commit 0dfd31b

Please sign in to comment.