-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[UWP] Min viable FontImageSource #4817
[UWP] Min viable FontImageSource #4817
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
{ | ||
var iconcolor = fontsource.Color != Color.Default ? fontsource.Color : Color.White; | ||
var device = CanvasDevice.GetSharedDevice(); | ||
var localDpi = Windows.Graphics.Display.DisplayInformation.GetForCurrentView().LogicalDpi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Android and iOS are not so much, but UWP supports multi-scale and multi-monitor. The common case would be to move the app from one screen to another, potentially changing the resolution. We might want to handle this case to avoid distorted images.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, yes. But here we return the bitmap. And if it is redrawn at each DPI measurement, then this greatly affects the performance. With a large number of icons, the application freezes for a couple of seconds. Therefore, I added a minimum dpi equal to 300. This should be enough so that the icon does not look soapy in most cases.
- the minimum Dpi of the icon is 300
else | ||
{ | ||
throw new InvalidCastException($"\"{Control.Source.GetType().FullName}\" is not supported."); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would maybe put this into an extension method because I don't think this is the only place we might use this. I am thinking image buttons and other bits that use images.
Long live @paymicro! |
* min viable fontImageSource * [UWP] Min viable FontImageSource (#4817) * [UWP] font image source * address comment * [UWP] performance optimization of the rendering of icons font - the minimum Dpi of the icon is 300 * char -> string; CR feedback
* min viable fontImageSource * [UWP] Min viable FontImageSource (#4817) * [UWP] font image source * address comment * [UWP] performance optimization of the rendering of icons font - the minimum Dpi of the icon is 300 * char -> string; CR feedback
* min viable fontImageSource * [UWP] Min viable FontImageSource (xamarin#4817) * [UWP] font image source * address comment * [UWP] performance optimization of the rendering of icons font - the minimum Dpi of the icon is 300 * char -> string; CR feedback
It looks like the Win2D.uwp didn't get installed automatically for this customer. #5188. Let's investigate why. |
Description of Change
see #4747
Issues Resolved
API Changes
None
Platforms Affected
Before/After Screenshots
Testing Procedure
Run Font ImageSource - Legacy
PR Checklist