QCachedPainter: use the render hints of the painter we got

Amends 1ad9330a9c56a59d407f5644fe547ba69c1a205b. If the painter that we
get from the style (or the widget) has render hints set, then we want to
use those when drawing the cached pixmap as well.

This assumes that QPixmap as a paint device supports all the required
engine features, which it does as it's using the software rasterizer.

This fixes baseline test mismatches for QDial and QSlider, as those want
to be rendered using an anti-aliased painter.

Change-Id: Iaf9ec1c3a4f940f31fb34badc436e499e19f6698
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
Volker Hilsheimer 2024-11-12 10:09:15 +01:00
parent 60ca2b5696
commit 33b134ff02

View File

@ -2440,6 +2440,7 @@ QCachedPainter::QCachedPainter(QPainter *painter, const QString &cachePrefix,
if (!m_alreadyCached) {
m_pixmap = styleCachePixmap(sz, dpr);
m_pixmapPainter = std::make_unique<QPainter>(&m_pixmap);
m_pixmapPainter->setRenderHints(painter->renderHints());
s_pixmapCacheKeys += m_pixmapName;
}
}