Scale up folder icon before creating preview overlays
ClosedPublic

Authored by muhlenpfordt on May 7 2018, 10:27 AM.

Details

Summary

If a custom folder icon is smaller than the requested preview size
KIO::PreviewJob returns a pixmap of only that size. E.g. dolphin
scales this up to its current thumbnail size which results in ugly
overlay icons for very small folder icons. If the folder icon is
scaled up before creating the overlay icons the overall preview
looks much better.

CCBUG: 315983

Test Plan
  1. Set a small custom icon (e.g. 32 px) for a folder containing images
  2. Start dolphin with Preview enabled in the parent folder
  3. Zoom thumbnails to e.g. 128 pixels overlay
  4. The overlayed preview icons should not be blurry
Before:After:

Diff Detail

Repository
R320 KIO Extras
Branch
scale-up-folder-icon (branched from Applications/18.04)
Lint
Lint OK
Unit
No Unit Test Coverage
muhlenpfordt requested review of this revision.May 7 2018, 10:27 AM
muhlenpfordt created this revision.
muhlenpfordt added subscribers: rkflx, ngraham.

Also see D12509 for Gwenview effects on this issue.

rkflx accepted this revision.May 7 2018, 7:54 PM

+1, but I'd feel a bit uncomfortable (almost) self-approving my own patch (sans the qMax) here, so perhaps wait until the end of the week for any other opinions before committing.

BTW, any reason you are targetting master only?

This revision is now accepted and ready to land.May 7 2018, 7:54 PM

+1, but I'd feel a bit uncomfortable (almost) self-approving my own patch (sans the qMax) here, so perhaps wait until the end of the week for any other opinions before committing.

I did nearly the same in my initial search, except for the separate extent var. So, two ideas leading to the same code can't be wrong. ;) But sure, I'll wait until next week.

BTW, any reason you are targetting master only?

I wanted to be careful here since I'm a bit afraid of changing library functions. If you think it's ok for Applications/18.04 I'll rebase it.

Forgot to mention this...
There's a nice test application in kio for viewing a folder's preview in any desired size (created by KIO::PreviewJob): previewtest. Just enter the full path to the folder here.

rkflx added a comment.May 8 2018, 10:35 AM

I wanted to be careful here since I'm a bit afraid of changing library functions. If you think it's ok for Applications/18.04 I'll rebase it.

How else would you fix problems in a library ;)

Nevertheless, let's check the impact of this again: https://lxr.kde.org/ident?_i=thumbForDirectory

Does not look too critical to me, and we probably tested most of the code paths.

Rebase to Applications/18.04

Nevertheless, let's check the impact of this again: https://lxr.kde.org/ident?_i=thumbForDirectory
Does not look too critical to me, and we probably tested most of the code paths.

The normal KDE file dialog (e.g. KateFileOpen...) also uses the upscaled preview without any problems.
I searched for (KIO::)filePreview on lxr which gives a couple of results. They all use similar methods to handle the icons and I can't spot anything unsual related to the returned size.
Ok to commit?

Ok to commit?

Sure, go ahead 👍

This revision was automatically updated to reflect the committed changes.