QImage::colorTable() method optimization

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-06-05 19:02:51 +03:00
parent fb246bc58e
commit 16fc3caacf

View file

@ -1190,8 +1190,10 @@ void QImage::setColorTable(const QVector<QRgb> &colors)
QVector<QRgb> QImage::colorTable() const
{
QVector<QRgb> result;
if (!d || d->depth != 1)
if (!d || d->depth != 1) {
return result;
}
result.reserve(2);
result.append(d->mono0);
result.append(d->mono1);
return result;