summaryrefslogtreecommitdiffstats
path: root/src/plugins/imageformats
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/imageformats')
-rw-r--r--src/plugins/imageformats/jpeg/jpeg.pro2
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp25
2 files changed, 4 insertions, 23 deletions
diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro
index 9181abb465..8954cc6402 100644
--- a/src/plugins/imageformats/jpeg/jpeg.pro
+++ b/src/plugins/imageformats/jpeg/jpeg.pro
@@ -1,6 +1,6 @@
TARGET = qjpeg
-QT += core-private
+QT += core-private gui-private
SOURCES += main.cpp qjpeghandler.cpp
HEADERS += main.h qjpeghandler_p.h
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index 52e8b39f11..d89b8d398b 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -45,6 +45,7 @@
#include <qbuffer.h>
#include <qmath.h>
#include <private/qsimd_p.h>
+#include <private/qimage_p.h> // for qt_getImageText
#include <stdio.h> // jpeglib needs this to be pre-included
#include <setjmp.h>
@@ -491,30 +492,10 @@ inline my_jpeg_destination_mgr::my_jpeg_destination_mgr(QIODevice *device)
free_in_buffer = max_buf;
}
-
static inline void set_text(const QImage &image, j_compress_ptr cinfo, const QString &description)
{
- QMap<QString, QString> text;
- foreach (const QString &key, image.textKeys()) {
- if (!key.isEmpty())
- text.insert(key, image.text(key));
- }
- foreach (const QString &pair, description.split(QLatin1String("\n\n"))) {
- int index = pair.indexOf(QLatin1Char(':'));
- if (index >= 0 && pair.indexOf(QLatin1Char(' ')) < index) {
- QString s = pair.simplified();
- if (!s.isEmpty())
- text.insert(QLatin1String("Description"), s);
- } else {
- QString key = pair.left(index);
- if (!key.simplified().isEmpty())
- text.insert(key, pair.mid(index + 2).simplified());
- }
- }
- if (text.isEmpty())
- return;
-
- for (QMap<QString, QString>::ConstIterator it = text.constBegin(); it != text.constEnd(); ++it) {
+ const QMap<QString, QString> text = qt_getImageText(image, description);
+ for (auto it = text.begin(), end = text.end(); it != end; ++it) {
QByteArray comment = it.key().toLatin1();
if (!comment.isEmpty())
comment += ": ";