mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 02:42: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())
|
if (rect.isNull())
|
||||||
return image;
|
return image;
|
||||||
|
|
||||||
QRect clipped = rect.intersected(QRect(0, 0, w, h));
|
return image.copy(rect);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRasterPixmapData::setAlphaChannel(const QPixmap &alphaChannel)
|
void QRasterPixmapData::setAlphaChannel(const QPixmap &alphaChannel)
|
||||||
|
|
|
@ -247,10 +247,11 @@ void QPixmapData::setSerialNumber(int serNo)
|
||||||
|
|
||||||
QImage QPixmapData::toImage(const QRect &rect) const
|
QImage QPixmapData::toImage(const QRect &rect) const
|
||||||
{
|
{
|
||||||
if (rect.contains(QRect(0, 0, w, h)))
|
QImage image = toImage();
|
||||||
return toImage();
|
if (rect.isNull())
|
||||||
else
|
return image;
|
||||||
return toImage().copy(rect);
|
|
||||||
|
return image.copy(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage* QPixmapData::buffer()
|
QImage* QPixmapData::buffer()
|
||||||
|
|
Loading…
Add table
Reference in a new issue