When filling a pixmap after an assignment ensure the set DPR is not lost
Pick-to: 6.2 5.15 Change-Id: I649547ea277f9d074e6638e4b7b1206d3d3d976b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
parent
ed3e1ecb27
commit
a36c84c6a3
@ -899,6 +899,7 @@ void QPixmap::fill(const QColor &color)
|
||||
// it will be filled with new pixel data anyway.
|
||||
QPlatformPixmap *d = data->createCompatiblePlatformPixmap();
|
||||
d->resize(data->width(), data->height());
|
||||
d->setDevicePixelRatio(data->devicePixelRatio());
|
||||
data = d;
|
||||
}
|
||||
data->fill(color);
|
||||
|
@ -121,6 +121,7 @@ private slots:
|
||||
void copy();
|
||||
void move();
|
||||
void deepCopyPreservesDpr();
|
||||
void fillPreservesDpr();
|
||||
void dprPassthrough();
|
||||
void depthOfNullObjects();
|
||||
|
||||
@ -1172,6 +1173,19 @@ void tst_QPixmap::deepCopyPreservesDpr()
|
||||
QCOMPARE(dest.devicePixelRatio(), dpr);
|
||||
}
|
||||
|
||||
// Check that the DPR is preserved after doing a fill after an
|
||||
// assigned copy of the QPixmap
|
||||
void tst_QPixmap::fillPreservesDpr()
|
||||
{
|
||||
const qreal dpr = 2;
|
||||
QPixmap src(32, 32);
|
||||
src.setDevicePixelRatio(dpr);
|
||||
src.fill(Qt::red);
|
||||
QPixmap dest = src;
|
||||
dest.fill(Qt::blue);
|
||||
QCOMPARE(dest.devicePixelRatio(), dpr);
|
||||
}
|
||||
|
||||
void tst_QPixmap::dprPassthrough()
|
||||
{
|
||||
const qreal dpr = 2;
|
||||
|
Loading…
Reference in New Issue
Block a user