mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
optimize QPixmapData::toImage()
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
29c8c34392
commit
dfb87495bf
2 changed files with 6 additions and 12 deletions
|
@ -282,14 +282,7 @@ QImage QRasterPixmapData::toImage(const QRect &rect) const
|
|||
if (rect.isNull())
|
||||
return image;
|
||||
|
||||
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),
|
||||
clipped.width(), clipped.height(),
|
||||
image.bytesPerLine(), image.format());
|
||||
else
|
||||
return image.copy(clipped);
|
||||
return image.copy(rect);
|
||||
}
|
||||
|
||||
void QRasterPixmapData::setAlphaChannel(const QPixmap &alphaChannel)
|
||||
|
|
|
@ -247,10 +247,11 @@ void QPixmapData::setSerialNumber(int serNo)
|
|||
|
||||
QImage QPixmapData::toImage(const QRect &rect) const
|
||||
{
|
||||
if (rect.contains(QRect(0, 0, w, h)))
|
||||
return toImage();
|
||||
else
|
||||
return toImage().copy(rect);
|
||||
QImage image = toImage();
|
||||
if (rect.isNull())
|
||||
return image;
|
||||
|
||||
return image.copy(rect);
|
||||
}
|
||||
|
||||
QImage* QPixmapData::buffer()
|
||||
|
|
Loading…
Add table
Reference in a new issue