[vlc-commits] [Git][videolan/vlc][master] qml: use reasonable source size for delegate images

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Feb 1 12:25:38 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
020b3c8b by Fatih Uzunoglu at 2025-02-01T12:04:41+00:00
qml: use reasonable source size for delegate images

Delegate images are meant to be cached, and put in the
atlas. We have to use a reasonable size otherwise they
can easily spoil the cache.

Currently source size is used as worst case (the largest
the image can be), but most of the time the interface
window size is wide enough to display multiple items,
where in that case item size is not as large as the
worst case.

Granted this will make images have poorer quality when
the interface has such a size that only one/two items are
visible per row, as then the items would scale up to use
the all available width. However, it needs to be balanced.

I propose using the average case and not the worst case
for the source size. I propose that we determine the
average (nbItemPerRow) to be 3 for the moment. This means
that we target the optimal quality when there are at least
three items displayed per row and not less.

I used the formula provided in the comments, one line above.

- - - - -


1 changed file:

- modules/gui/qt/util/qml/GridSizeHelper.qml


Changes:

=====================================
modules/gui/qt/util/qml/GridSizeHelper.qml
=====================================
@@ -65,6 +65,6 @@ QtObject{
     // NOTE: Find the maximum picture size for nbItemPerRow == 1, so that we downscale in most of the cases
     //       formula for maxPictureWidth depended on nbItemPerRow would be:
     //       (basePictureWidth + _defaultHorizontalSpacing) * (1 + 1 / nbItemPerRow) - _defaultHorizontalSpacing
-    readonly property int maxPictureWidth: 2 * basePictureWidth + _defaultHorizontalSpacing
+    readonly property int maxPictureWidth: (basePictureWidth + _defaultHorizontalSpacing) * (1 + 1 / 3) - _defaultHorizontalSpacing
     readonly property int maxPictureHeight: (basePictureHeight / basePictureWidth) * maxPictureWidth
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/020b3c8b29821b45ae024b40b305f19ee6401e65

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/020b3c8b29821b45ae024b40b305f19ee6401e65
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list