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
Binary file not shown.
27 changes: 0 additions & 27 deletions src/Controls/tests/TestCases.HostApp/Issues/FontImageUITest.cs

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
22 changes: 9 additions & 13 deletions src/Graphics/src/Graphics/Platforms/iOS/UIImageExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,17 @@ public static UIImage ScaleImage(this UIImage target, float maxWidth, float maxH

public static UIImage ScaleImage(this UIImage target, CGSize size, bool disposeOriginal = false)
{
using (var renderer = new UIGraphicsImageRenderer(size))
{
var resultImage = renderer.CreateImage((UIGraphicsImageRendererContext imageContext) =>
{
var cgcontext = imageContext.CGContext;
cgcontext.DrawImage(new CGRect(CGPoint.Empty, size), target.CGImage);

if (disposeOriginal)
{
target.Dispose();
}
});
UIGraphics.BeginImageContext(size);
Copy link

Copilot AI Jul 3, 2025

Choose a reason for hiding this comment

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

Using UIGraphics.BeginImageContext without specifying options may produce images at the wrong scale (non-retina) and is less efficient. Consider using UIGraphicsBeginImageContextWithOptions(size, opaque: false, scale: UIScreen.MainScreen.Scale) or reinstating UIGraphicsImageRenderer to ensure correct scaling and performance.

Suggested change
UIGraphics.BeginImageContext(size);
UIGraphics.BeginImageContextWithOptions(size, false, UIScreen.MainScreen.Scale);

Copilot uses AI. Check for mistakes.
target.Draw(new CGRect(CGPoint.Empty, size));
var image = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();

return resultImage;
if (disposeOriginal)
{
target.Dispose();
}

return image;
}

public static UIImage NormalizeOrientation(this UIImage target, bool disposeOriginal = false)
Expand Down
Loading