Center icons properly if size doesn't fit
ClosedPublic

Authored by broulik on Oct 18 2018, 8:08 AM.

Details

Summary

When requesting an icon size that cannot be served, the pixmap is centered in the requested size.
By using the original pixmap's device pixel ratio we ensure the padded pixmap is painted correctly.

BUG: 396990

Test Plan

There's still various issues in Dolphin's view engine when using fractional scaling, such as icons being too small, or preview icons larger then file icons, etc but at least icons aren't cut-off and misaligned anymore.

There is also a bug in caching and restoring from cache the icon. Initally the icon is fine, then it's cached to disk but when it is restored the icon doesn't match the requested size anymore and is instead padded.
Probably us writing "icon@2x" to cache, then restoring it as "icon@1.4" and then there's a mismatch..

  • deleted icon cache in ~/.cache, ran QT_SCREEN_SCALE_FACTORS=1.4 dolphin, no longer have icons rendered out of bounds

Diff Detail

Repository
R302 KIconThemes
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Oct 18 2018, 8:08 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptOct 18 2018, 8:08 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
broulik requested review of this revision.Oct 18 2018, 8:08 AM
broulik updated this revision to Diff 43847.Oct 18 2018, 8:13 AM
broulik edited the test plan for this revision. (Show Details)
  • Also properly create new pixmap
davidedmundson accepted this revision.Oct 18 2018, 8:41 AM
This revision is now accepted and ready to land.Oct 18 2018, 8:41 AM
This revision was automatically updated to reflect the committed changes.