Draw only visible filenames in thumbnails

This commit is contained in:
2024-02-11 13:52:52 +01:00
parent dc2a781d3b
commit ae07d4793b
+3 -1
View File
@@ -366,7 +366,9 @@ void ImageWidget::paintGL()
QPainter painter(this); QPainter painter(this);
const int w = width()/THUMB_SIZE_BORDER; const int w = width()/THUMB_SIZE_BORDER;
const int off = (THUMB_SIZE_BORDER - THUMB_SIZE) / 2; const int off = (THUMB_SIZE_BORDER - THUMB_SIZE) / 2;
for(int i=0; i < m_thumbnailCount; i++) int start = std::max((int)(m_dy / THUMB_SIZE_BORDER_Y * w - w), 0);
int end = std::min((int)(m_dy + m_height) / THUMB_SIZE_BORDER_Y * w + w, m_thumbnailCount);
for(int i=start; i < end; i++)
{ {
float x = (i % w) * THUMB_SIZE_BORDER; float x = (i % w) * THUMB_SIZE_BORDER;
float y = i / w * THUMB_SIZE_BORDER_Y + THUMB_SIZE - m_dy + off; float y = i / w * THUMB_SIZE_BORDER_Y + THUMB_SIZE - m_dy + off;