Skip to content

Conversation

@jiripolasek
Copy link
Collaborator

@jiripolasek jiripolasek commented Jan 5, 2026

Summary of the Pull Request

This PR implements actual cache in IconCacheService and adds some fixes on top for free.

The good

  • IconCacheService now caches decoded icons
  • Ensures that UI thread is not starved by loading icons by limiting number of threads that can load icons at any given time
  • IconCacheService decodes bitmaps directly to the required size to reduce memory usage
  • IconBox now reacts to theme, DPI scale, and size changes immediately
  • Introduced AdaptiveCache with time-based decay to improve icon reuse
  • Updated IconCacheProvider and IconCacheService to handle multiple icon sizes and scale-aware caching
  • Added priority-based decoding in IconCacheService for more responsive loading
  • Extended IconPathConverter to support target icon sizes
  • Switched hero images in ShellPage to use the jumbo icon cache
  • Made MainWindow title bar logic resilient to a null XamlRoot
  • Fixed Tag icon positioning

The bad

  • Since IconData lacks a unique identity, when it includes a stream, it relies on simple reference equality, acknowledging that it might not be stable. We might cache some obsolete garbage because of this, but it is fast and better than nothing at all. Yet another task for the future me.

PR Checklist

  • Closes: #
  • Related to: CmdPal: go vzoooom #44407
  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Refactor and extend icon rendering infrastructure to support DPI-aware, theme-responsive, and size-adaptive icon caching.

- Refactors`IconBox` to track and respond to theme, scale, and size changes
- Adds`scale` property to `SourceRequestedEventArgs` for DPI-aware icon generation
- Introduces`AdaptiveCache` with time-based decay for efficient icon reuse
- Updates`IconCacheProvider` and `IconCacheService` to support multiple icon sizes (e.g., 20x20, 64x64), scale-aware caching, and robust async loading
- `IconCacheService` now decodes bitmap to required size to reduce memory usage
- Introduces priority decoding in `IconCacheService`
- Extends`IconPathConverter` to accept target size for icon generation
- Use jumbo icon cache for hero images in `ShellPage`
- Handles null `XamlRoot` safely in `MainWindow` title bar logic
- Fixes Tag icon position
@jiripolasek jiripolasek self-assigned this Jan 5, 2026
@jiripolasek jiripolasek added the Product-Command Palette Refers to the Command Palette utility label Jan 5, 2026
@github-actions

This comment has been minimized.

@Jay-o-Way
Copy link
Collaborator

Jay-o-Way commented Jan 6, 2026

When you're ready, one or two screenshots would be welcome - where fit.

P.S. Me - for one - find your light sarcasm very amusing 😁

@zadjii-msft
Copy link
Member

zadjii-msft commented Jan 8, 2026

This one's pretty big so I'm gonna hold it for 0.98

@zadjii-msft zadjii-msft added the Don't merge - Hold for release Hold off on merging this PR, even if it's approved. label Jan 8, 2026
@jiripolasek
Copy link
Collaborator Author

This one's pretty big so I'm gonna hold it for 0.98

Definitely! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Don't merge - Hold for release Hold off on merging this PR, even if it's approved. Product-Command Palette Refers to the Command Palette utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants