summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qimage.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2020-03-26 10:53:44 +0100
committerMarc Mutz <marc.mutz@kdab.com>2020-04-23 08:38:49 +0000
commit5c1446e3faf7684dfa559edc49611b92ea825776 (patch)
tree2a505d25a3eba48d7e14f87c040deb01a26fdbfd /src/gui/image/qimage.cpp
parent871e2981dde9836311bbc560f58805c4b0d61839 (diff)
QImage: optimize convertWithPalette()
The old code got a QMap serialized as a QString and parsed it to re-create the same map. Just copy the map. Change-Id: Ic71b9fa9d822eab53fe37dfb4d76223cd69ac057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/gui/image/qimage.cpp')
-rw-r--r--src/gui/image/qimage.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 2646d298e9..499c527cfc 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -2149,12 +2149,7 @@ static QImage convertWithPalette(const QImage &src, QImage::Format format,
QImage dest(src.size(), format);
dest.setColorTable(clut);
- QString textsKeys = src.text();
- const auto textKeyList = textsKeys.splitRef(QLatin1Char('\n'), Qt::SkipEmptyParts);
- for (const auto &textKey : textKeyList) {
- const auto textKeySplitted = textKey.split(QLatin1String(": "));
- dest.setText(textKeySplitted[0].toString(), textKeySplitted[1].toString());
- }
+ QImageData::get(dest)->text = QImageData::get(src)->text;
int h = src.height();
int w = src.width();