There were a couple of mistakes when porting it to use devicePixelRatio resulting in it constantly recreating pixmaps when on a high dpi screen. There can also be rounding errors when scaling pixmaps when keeping aspect ratio, allow a 1px size difference.
Details
- Reviewers
elvisangelaccio davidedmundson - Group Reviewers
Dolphin - Commits
- R318:ae3438eb0809: [KStandardItemListWidget] Avoid needless image resizing
Only Folder thumbnails are still scaled up but that needs further investigation. Regular image thumbnails are no longer scaled due to off-by-1 rounding error
Diff Detail
- Repository
- R318 Dolphin
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
src/kitemviews/kstandarditemlistwidget.cpp | ||
---|---|---|
1014–1015 | It's best to avoid the term "scale". It could be scaling from logical to device pixels, or scailng from device to logical. Sticking to either the term "logical" or "device" seems to work best. | |
1385 | This is overly complex. We have the pixmap at size in device pixels (logical size * DPR) When we divide back to logical pixels, we lose resolution. So....don't. You can do it all in device pixels, which is the part that's relevant here. if (m_scaledPixmapSize * pixmap.devicePixelRatio != pixmap.size()) { } |
src/kitemviews/kstandarditemlistwidget.cpp | ||
---|---|---|
1385 | Even if I do it here, I still get cases where requested size QSize(256, 192) is off by one pixel to QSize(257, 192) I think the scale(Qt::KeepAspectRatio) causes rounding errors... somewhere. |