commit 31e29d7eac36be9d4cb097a889b09fff7cb7f30d
Author: Yaroslav Sidlovsky <zawertun(a)gmail.com>
Date: Tue Jun 23 01:36:33 2020 +0300
added patch to work with libheif-1.7.0
qt-heif-image-plugin-fix-libheif-1.7.0.patch | 49 ++++++++++++++++++++++++++++
qt-heif-image-plugin.spec | 10 ++++--
2 files changed, 57 insertions(+), 2 deletions(-)
---
diff --git a/qt-heif-image-plugin-fix-libheif-1.7.0.patch
b/qt-heif-image-plugin-fix-libheif-1.7.0.patch
new file mode 100644
index 0000000..03ae7ee
--- /dev/null
+++ b/qt-heif-image-plugin-fix-libheif-1.7.0.patch
@@ -0,0 +1,49 @@
+From 3288ae60b96efa404fbeb40598a8567bc8c75761 Mon Sep 17 00:00:00 2001
+From: Markus Diem <diemmarkus(a)gmail.com>
+Date: Mon, 22 Jun 2020 11:12:12 +0200
+Subject: [PATCH] maps color format from HEIF to Qt (i.e. RGB88)
+
+- this patch is needed to load RGB888 heif images with libheif 1.7.0
+- maps heif_chroma_interleaved_RGB to QImage::Format_RGB888
+- other conversions are not added because I don't have test images
+---
+ src/qheifhandler.cpp | 20 +++++++++++++++++++-
+ 1 file changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/src/qheifhandler.cpp b/src/qheifhandler.cpp
+index e1b9933..822c45d 100644
+--- a/src/qheifhandler.cpp
++++ b/src/qheifhandler.cpp
+@@ -288,13 +288,31 @@ bool QHeifHandler::read(QImage* destImage)
+ qWarning("QHeifHandler::read() invalid stride: %d", stride);
+ return false;
+ }
++
++ // map image format
++ heif_chroma heifFormat = heif_image_get_chroma_format(srcImage.get());
++ QImage::Format qtFormat;
+
++ switch (heifFormat) {
++ case heif_chroma_interleaved_RGB: {
++ qtFormat = QImage::Format_RGB888;
++ break;
++ }
++ case heif_chroma_interleaved_RGBA: {
++ qtFormat = QImage::Format_RGBA8888;
++ break;
++ }
++ // TODO: add other formats i.e. heif_chroma_monochrome here
++ default:
++ qtFormat = QImage::Format_RGBA8888;
++ }
++
+ // move data ownership to QImage
+ heif_image* dataImage = srcImage.release();
+
+ *destImage = QImage(
+ data, imgSize.width(), imgSize.height(),
+- stride, QImage::Format_RGBA8888,
++ stride, qtFormat,
+ [](void* img) { heif_image_release(static_cast<heif_image*>(img)); },
+ dataImage
+ );
diff --git a/qt-heif-image-plugin.spec b/qt-heif-image-plugin.spec
index 9c12965..ae0d02a 100644
--- a/qt-heif-image-plugin.spec
+++ b/qt-heif-image-plugin.spec
@@ -1,12 +1,15 @@
Name: qt-heif-image-plugin
Version: 0.3.3
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Qt plugin for HEIF images
License: LGPLv3
URL:
https://github.com/jakar/qt-heif-image-plugin
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
+#
https://github.com/jakar/qt-heif-image-plugin/issues/17
+Patch0: qt-heif-image-plugin-fix-libheif-1.7.0.patch
+
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: cmake(Qt5)
@@ -18,7 +21,7 @@ BuildRequires: qt5-rpm-macros
%prep
-%autosetup
+%autosetup -p1
%build
@@ -37,6 +40,9 @@ BuildRequires: qt5-rpm-macros
%changelog
+* Mon Jun 22 2020 Yaroslav Sidlovsky <zawertun(a)gmail.com> - 0.3.3-2
+- added patch to work with libheif-1.7.0
+
* Sun Feb 23 2020 Yaroslav Sidlovsky <zawertun(a)gmail.com> - 0.3.3-1
- First spec for version 0.3.3