From 9c9f98f2ff255da3e9a3ccdb81a82c53a105c8f9 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 7 Dec 2016 14:37:12 +0100 Subject: Implement support for 16bpc image formats Adds support for 16bit per color image formats in QImage. This makes it possible to read and write 16bpc PNGs, and take full advantage of the 16bpc paint engine. [ChangeLog][QtGui][QImage] QImage now supports 64bit image formats with 16 bits per color channel, compatible with 16bpc PNG or RGBA16 OpenGL formats. Task-number: QTBUG-45858 Change-Id: Icd28bd5868a6efcf65cb5bd56031d42941e04099 Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qmemrotate.cpp | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'src/gui/painting/qmemrotate.cpp') diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp index 25aa6a3122..43aeff3268 100644 --- a/src/gui/painting/qmemrotate.cpp +++ b/src/gui/painting/qmemrotate.cpp @@ -239,6 +239,12 @@ inline void qt_memrotate90_template(const quint32 *src, int w, int h, i qt_memrotate90_tiled_unpacked(src, w, h, sstride, dest, dstride); } +template <> +inline void qt_memrotate90_template(const quint64 *src, int w, int h, int sstride, quint64 *dest, int dstride) +{ + qt_memrotate90_tiled_unpacked(src, w, h, sstride, dest, dstride); +} + template Q_STATIC_TEMPLATE_FUNCTION inline void qt_memrotate180_template(const T *src, int w, int h, int sstride, T *dest, int dstride) @@ -275,6 +281,12 @@ inline void qt_memrotate270_template(const quint32 *src, int w, int h, qt_memrotate270_tiled_unpacked(src, w, h, sstride, dest, dstride); } +template <> +inline void qt_memrotate270_template(const quint64 *src, int w, int h, int sstride, quint64 *dest, int dstride) +{ + qt_memrotate270_tiled_unpacked(src, w, h, sstride, dest, dstride); +} + #define QT_IMPL_MEMROTATE(type) \ Q_GUI_EXPORT void qt_memrotate90(const type *src, int w, int h, int sstride, \ type *dest, int dstride) \ @@ -309,9 +321,7 @@ Q_GUI_EXPORT void qt_memrotate270(const type *src, int w, int h, int sstride, \ qt_memrotate270_tiled_unpacked(src, w, h, sstride, dest, dstride); \ } - - - +QT_IMPL_MEMROTATE(quint64) QT_IMPL_MEMROTATE(quint32) QT_IMPL_MEMROTATE(quint16) QT_IMPL_MEMROTATE(quint24) @@ -377,6 +387,22 @@ void qt_memrotate270_32(const uchar *srcPixels, int w, int h, int sbpl, uchar *d qt_memrotate270((const uint *)srcPixels, w, h, sbpl, (uint *)destPixels, dbpl); } + +void qt_memrotate90_64(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate90((const quint64 *)srcPixels, w, h, sbpl, (quint64 *)destPixels, dbpl); +} + +void qt_memrotate180_64(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate180((const quint64 *)srcPixels, w, h, sbpl, (quint64 *)destPixels, dbpl); +} + +void qt_memrotate270_64(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate270((const quint64 *)srcPixels, w, h, sbpl, (quint64 *)destPixels, dbpl); +} + MemRotateFunc qMemRotateFunctions[QPixelLayout::BPPCount][3] = // 90, 180, 270 { @@ -387,6 +413,7 @@ MemRotateFunc qMemRotateFunctions[QPixelLayout::BPPCount][3] = { qt_memrotate90_16, qt_memrotate180_16, qt_memrotate270_16 }, // BPP16, { qt_memrotate90_24, qt_memrotate180_24, qt_memrotate270_24 }, // BPP24 { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // BPP32 + { qt_memrotate90_64, qt_memrotate180_64, qt_memrotate270_64 }, // BPP64 }; QT_END_NAMESPACE -- cgit v1.2.3