Commit 29d09bef authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Prefer generating thumbnails for things that are even slightly visible

Otherwise we may end up with things not showing up at all
parent ea22bed7
...@@ -920,13 +920,7 @@ void ThumbnailView::generateThumbnailsForItems() ...@@ -920,13 +920,7 @@ void ThumbnailView::generateThumbnailsForItems()
// Compute distance // Compute distance
int distance; int distance;
const QRect itemRect = visualRect(index); const QRect itemRect = visualRect(index);
const qreal itemSurface = itemRect.width() * itemRect.height(); if (itemRect.isValid()) {
const QRect visibleItemRect = visibleRect.intersected(itemRect);
qreal visibleItemFract = 0;
if (itemSurface > 0) {
visibleItemFract = visibleItemRect.width() * visibleItemRect.height() / itemSurface;
}
if (visibleItemFract > 0.7) {
// Item is visible, order thumbnails from left to right, top to bottom // Item is visible, order thumbnails from left to right, top to bottom
// Distance is computed so that it is between 0 and visibleSurface // Distance is computed so that it is between 0 and visibleSurface
distance = itemRect.top() * visibleRect.width() + itemRect.left(); distance = itemRect.top() * visibleRect.width() + itemRect.left();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment