diff options
-rw-r--r-- | src/plugins/imageformats/webp/qwebphandler.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/imageformats/webp/qwebphandler.cpp b/src/plugins/imageformats/webp/qwebphandler.cpp index 8834820..599cb00 100644 --- a/src/plugins/imageformats/webp/qwebphandler.cpp +++ b/src/plugins/imageformats/webp/qwebphandler.cpp @@ -137,8 +137,13 @@ bool QWebpHandler::write(const QImage &image) } QImage srcImage = image; +#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN if (srcImage.format() != QImage::Format_ARGB32) srcImage = srcImage.convertToFormat(QImage::Format_ARGB32); +#else /* Q_BIG_ENDIAN */ + if (srcImage.format() != QImage::Format_RGBA8888) + srcImage = srcImage.convertToFormat(QImage::Format_RGBA8888); +#endif WebPPicture picture; WebPConfig config; @@ -151,7 +156,11 @@ bool QWebpHandler::write(const QImage &image) picture.width = srcImage.width(); picture.height = srcImage.height(); picture.use_argb = 1; +#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN if (!WebPPictureImportBGRA(&picture, srcImage.bits(), srcImage.bytesPerLine())) { +#else /* Q_BIG_ENDIAN */ + if (!WebPPictureImportRGBA(&picture, srcImage.bits(), srcImage.bytesPerLine())) { +#endif qWarning() << "failed to import image data to webp picture."; WebPPictureFree(&picture); |