Fix hidpi issues with scaled avatars in message list delegate
ClosedPublic

Authored by mwolff on May 15 2020, 8:03 AM.

Details

Summary

Introduce a per-DPR LRU pixmap cache for the scaled avatars. This
should ensure ruqola uses the correct pixmap even in heterogeneous
multi-screen setups with different per-screen DPR values.

Diff Detail

Repository
R865 Ruqola
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mwolff requested review of this revision.May 15 2020, 8:03 AM
mwolff created this revision.
mwolff planned changes to this revision.May 15 2020, 8:09 AM

the layout uses the larger scale size now for the line height which is wrong, it needs to take the dpr into account - will fix

mwolff updated this revision to Diff 82908.May 15 2020, 8:17 AM

fix layouting

dfaure requested changes to this revision.May 15 2020, 9:36 AM
dfaure added inline comments.
src/widgets/room/delegate/messagelistdelegate.cpp
129

Why does this still use QPixmapCache, if we're caching the pixmap in mScaledAvatars anyway?

AFAICT we're not going to go into the first if() more than once for a given avatar.

src/widgets/room/delegate/messagelistdelegate.h
69

two spaces after "QWidget"

This revision now requires changes to proceed.May 15 2020, 9:36 AM
mwolff planned changes to this revision.May 15 2020, 10:09 AM
mwolff added inline comments.
src/widgets/room/delegate/messagelistdelegate.cpp
129

yes you are right, it's probably overkill - I'll remove it.

we'd be able to share across screens but that's very uncommon so let's remove that.

and while at it - I'll also not use a QHash for the per-dpr but only keep one cache and check if the DPR matches the current one

mwolff updated this revision to Diff 82916.May 15 2020, 10:22 AM
mwolff edited the summary of this revision. (Show Details)

don't use QPixmapCache

dfaure requested changes to this revision.May 15 2020, 11:04 AM
dfaure added inline comments.
src/core/lrucache.h
99

no clearing of mEntries here?

src/widgets/room/delegate/messagelistdelegate.h
69

still there

This revision now requires changes to proceed.May 15 2020, 11:04 AM
mwolff updated this revision to Diff 82924.May 15 2020, 11:07 AM
mwolff marked an inline comment as done.

fix ws issue and clear entries

dfaure accepted this revision.May 15 2020, 11:10 AM
dfaure added inline comments.
src/core/lrucache.h
100

Oh, it's a std::array, I thought it was some sort of vector.

OK then this probably isn't necessary, sorry for the wrong request.
Feel free to remove or keep, whatever you think is best.

This revision is now accepted and ready to land.May 15 2020, 11:10 AM
mwolff added inline comments.May 15 2020, 1:26 PM
src/core/lrucache.h
100

I'll keep it to free the memory of the previously-used pixmaps

This revision was automatically updated to reflect the committed changes.