Fix missing devicePixelRatio propagation on copy.

Change-Id: I0cb541fe8a92b7a7c159e0a6e5036baf43185a93
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Morten Johan Sørvig 2013-03-07 10:16:00 +01:00 committed by The Qt Project
parent eb5d8d2fc3
commit 7b9d45311c
2 changed files with 6 additions and 3 deletions

View File

@ -1126,6 +1126,7 @@ QImage QImage::copy(const QRect& r) const
image.d->colortable = d->colortable;
image.d->dpmx = d->dpmx;
image.d->dpmy = d->dpmy;
image.d->devicePixelRatio = d->devicePixelRatio;
image.d->offset = d->offset;
image.d->has_alpha_clut = d->has_alpha_clut;
image.d->text = d->text;

View File

@ -240,12 +240,14 @@ QImage QRasterPlatformPixmap::toImage(const QRect &rect) const
QRect clipped = rect.intersected(QRect(0, 0, w, h));
const uint du = uint(d);
if ((du % 8 == 0) && (((uint(clipped.x()) * du)) % 32 == 0))
return QImage(image.scanLine(clipped.y()) + clipped.x() * (du / 8),
if ((du % 8 == 0) && (((uint(clipped.x()) * du)) % 32 == 0)) {
QImage newImage(image.scanLine(clipped.y()) + clipped.x() * (du / 8),
clipped.width(), clipped.height(),
image.bytesPerLine(), image.format());
else
return newImage;
} else {
return image.copy(clipped);
}
}
QPaintEngine* QRasterPlatformPixmap::paintEngine() const