Skip to content

Commit e121cfc

Browse files
jeremy-visionaidPureWeen
authored andcommitted
Fix duplicate app icon resizing (#30920)
Possibly helps with #30900
1 parent 8ef63ce commit e121cfc

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/SingleProject/Resizetizer/src/ResizetizeImages.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ void ProcessAppIcon(ResizeImageInfo img, ConcurrentBag<ResizedImageInfo> resized
227227
continue;
228228
}
229229

230-
appTool.Resize(dpi, destination);
231230
var r = appTool.Resize(dpi, destination);
232231
resizedImages.Add(r);
233232
}

src/SingleProject/Resizetizer/src/SkiaSharpAppIconTools.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public SkiaSharpAppIconTools(ResizeImageInfo info, ILogger? logger)
3535

3636
public string AppIconName { get; }
3737

38-
public ResizedImageInfo Resize(DpiPath dpi, string destination, Func<Stream>? getStream = null)
38+
public ResizedImageInfo Resize(DpiPath dpi, string destination, Stream? stream = null)
3939
{
4040
var sw = new Stopwatch();
4141
sw.Start();
@@ -51,7 +51,7 @@ public ResizedImageInfo Resize(DpiPath dpi, string destination, Func<Stream>? ge
5151
using (var tempBitmap = new SKBitmap(canvasSize.Width, canvasSize.Height))
5252
{
5353
Draw(tempBitmap, dpi, unscaledCanvasSize);
54-
Save(tempBitmap, destination, getStream);
54+
Save(tempBitmap, destination, stream);
5555
}
5656

5757
sw.Stop();
@@ -60,11 +60,10 @@ public ResizedImageInfo Resize(DpiPath dpi, string destination, Func<Stream>? ge
6060
return new ResizedImageInfo { Dpi = dpi, Filename = destination };
6161
}
6262

63-
void Save(SKBitmap tempBitmap, string destination, Func<Stream>? getStream)
63+
void Save(SKBitmap tempBitmap, string destination, Stream? stream)
6464
{
65-
if (getStream is not null)
65+
if (stream is not null)
6666
{
67-
var stream = getStream();
6867
tempBitmap.Encode(stream, SKEncodedImageFormat.Png, 100);
6968
}
7069
else

src/SingleProject/Resizetizer/src/WindowsIconGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public ResizedImageInfo Generate()
4242
return new ResizedImageInfo { Dpi = dpi, Filename = destination };
4343
}
4444

45-
MemoryStream memoryStream = new MemoryStream();
46-
tools.Resize(dpi, destination, () => memoryStream);
45+
using MemoryStream memoryStream = new MemoryStream();
46+
tools.Resize(dpi, destination, memoryStream);
4747
memoryStream.Position = 0;
4848

4949
int numberOfImages = 1;

0 commit comments

Comments
 (0)