diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-09-19 16:11:10 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-09-25 18:34:30 +0200 |
commit | 8165a9c74b309a00c894504a5b6f26e696743c10 (patch) | |
tree | 76b68691489cbe755c070665a590e761479595b6 /src/gui/image/qppmhandler.cpp | |
parent | 342533864b4ea6dda62bf35dfb265303a967f8b3 (diff) |
Clean up QImage::Format switches
Changes some switches on QImage::Format that needed to be updated
whenever a new image format was added. Two were changed to matching
formats supported by BMP and PPM instead of what they don't support,
and two were changed to now use QPixelFormat values.
Change-Id: I5a14f1d7b7cc0451c68e4d6ab2361a5bd8dc8915
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/gui/image/qppmhandler.cpp')
-rw-r--r-- | src/gui/image/qppmhandler.cpp | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp index a436d10800..314abca9f0 100644 --- a/src/gui/image/qppmhandler.cpp +++ b/src/gui/image/qppmhandler.cpp @@ -257,31 +257,21 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy if (format == "pbm") { image = image.convertToFormat(QImage::Format_Mono); - } else if (image.depth() == 1) { - image = image.convertToFormat(QImage::Format_Indexed8); } else { switch (image.format()) { - case QImage::Format_RGB16: - case QImage::Format_RGB666: - case QImage::Format_RGB555: - case QImage::Format_RGB888: - case QImage::Format_RGB444: - case QImage::Format_RGBX8888: - case QImage::Format_BGR30: - case QImage::Format_RGB30: - image = image.convertToFormat(QImage::Format_RGB32); + case QImage::Format_Mono: + case QImage::Format_MonoLSB: + image = image.convertToFormat(QImage::Format_Indexed8); break; - case QImage::Format_ARGB8565_Premultiplied: - case QImage::Format_ARGB6666_Premultiplied: - case QImage::Format_ARGB8555_Premultiplied: - case QImage::Format_ARGB4444_Premultiplied: - case QImage::Format_RGBA8888: - case QImage::Format_RGBA8888_Premultiplied: - case QImage::Format_A2BGR30_Premultiplied: - case QImage::Format_A2RGB30_Premultiplied: - image = image.convertToFormat(QImage::Format_ARGB32); + case QImage::Format_Indexed8: + case QImage::Format_RGB32: + case QImage::Format_ARGB32: break; default: + if (image.hasAlphaChannel()) + image = image.convertToFormat(QImage::Format_ARGB32); + else + image = image.convertToFormat(QImage::Format_RGB32); break; } } |