Skip to content
Snippets Groups Projects
Commit 020b3c8b authored by Fatih Uzunoğlu's avatar Fatih Uzunoğlu Committed by Steve Lhomme
Browse files

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.
parent 093cb463
No related branches found
No related tags found
1 merge request!6632qml: use reasonable source size for delegate images
Pipeline #561520 passed with stage
in 18 minutes and 33 seconds
......@@ -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
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment