Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/SingleProject/Resizetizer/src/ResizetizeImages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ void ProcessAppIcon(ResizeImageInfo img, ConcurrentBag<ResizedImageInfo> resized
continue;
}

appTool.Resize(dpi, destination);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we add the resized image to a list?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm asking "why what was done" I don't understand which change you want info on?

It is why did I change Resize to return a value or why did I add the resizedImages output?

Copy link
Contributor

@MartyIX MartyIX Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I thought the question was clear. Sorry. Basically:

appTool.Resize(dpi, destination);

became in your PR (i.e. #13251):

appTool.Resize(dpi, destination); 
var r = appTool.Resize(dpi, destination);
resizedImages.Add(r);

so appTool.Resize(dpi, destination); was duplicated. And this PR (i.e. #30920) wants to remove appTool.Resize(dpi, destination); because it's duplicated.

The question was: Why did you duplicate appTool.Resize(dpi, destination)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol, probably a typo , somehow it slipped though.

var r = appTool.Resize(dpi, destination);
resizedImages.Add(r);
}
Expand Down
9 changes: 4 additions & 5 deletions src/SingleProject/Resizetizer/src/SkiaSharpAppIconTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public SkiaSharpAppIconTools(ResizeImageInfo info, ILogger? logger)

public string AppIconName { get; }

public ResizedImageInfo Resize(DpiPath dpi, string destination, Func<Stream>? getStream = null)
public ResizedImageInfo Resize(DpiPath dpi, string destination, Stream? stream = null)
{
var sw = new Stopwatch();
sw.Start();
Expand All @@ -51,7 +51,7 @@ public ResizedImageInfo Resize(DpiPath dpi, string destination, Func<Stream>? ge
using (var tempBitmap = new SKBitmap(canvasSize.Width, canvasSize.Height))
{
Draw(tempBitmap, dpi, unscaledCanvasSize);
Save(tempBitmap, destination, getStream);
Save(tempBitmap, destination, stream);
}

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

void Save(SKBitmap tempBitmap, string destination, Func<Stream>? getStream)
void Save(SKBitmap tempBitmap, string destination, Stream? stream)
{
if (getStream is not null)
if (stream is not null)
{
var stream = getStream();
tempBitmap.Encode(stream, SKEncodedImageFormat.Png, 100);
}
else
Expand Down
4 changes: 2 additions & 2 deletions src/SingleProject/Resizetizer/src/WindowsIconGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public ResizedImageInfo Generate()
return new ResizedImageInfo { Dpi = dpi, Filename = destination };
}

MemoryStream memoryStream = new MemoryStream();
tools.Resize(dpi, destination, () => memoryStream);
using MemoryStream memoryStream = new MemoryStream();
tools.Resize(dpi, destination, memoryStream);
memoryStream.Position = 0;

int numberOfImages = 1;
Expand Down
Loading