QRasterPlatformPixmap::createPixmapForImage(): preserve DPR
Remove the line setting the DPR from the source; the image is moved. Task-number: QTBUG-58653 Task-number: QTBUG-58645 Change-Id: I2de94681459dba1d69dee06da44617fb9fa35bcc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
4e5b013e32
commit
91120599ae
@ -349,8 +349,6 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage sourceImage, Qt::ImageCo
|
||||
}
|
||||
is_null = (w <= 0 || h <= 0);
|
||||
|
||||
if (image.d)
|
||||
image.d->devicePixelRatio = sourceImage.devicePixelRatio();
|
||||
//ensure the pixmap and the image resulting from toImage() have the same cacheKey();
|
||||
setSerialNumber(image.cacheKey() >> 32);
|
||||
if (image.d)
|
||||
|
@ -119,6 +119,7 @@ private slots:
|
||||
void refUnref();
|
||||
|
||||
void copy();
|
||||
void deepCopyPreservesDpr();
|
||||
void depthOfNullObjects();
|
||||
|
||||
void transformed();
|
||||
@ -1133,6 +1134,19 @@ void tst_QPixmap::copy()
|
||||
QCOMPARE(trans, transCopy);
|
||||
}
|
||||
|
||||
// QTBUG-58653: Force a deep copy of a pixmap by
|
||||
// having a QPainter and check whether DevicePixelRatio is preserved
|
||||
void tst_QPixmap::deepCopyPreservesDpr()
|
||||
{
|
||||
const qreal dpr = 2;
|
||||
QPixmap src(32, 32);
|
||||
src.setDevicePixelRatio(dpr);
|
||||
src.fill(Qt::red);
|
||||
QPainter painter(&src);
|
||||
const QPixmap dest = src.copy();
|
||||
QCOMPARE(dest.devicePixelRatio(), dpr);
|
||||
}
|
||||
|
||||
void tst_QPixmap::depthOfNullObjects()
|
||||
{
|
||||
QBitmap b1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user