forked from pool/krita
Accepting request 1139885 from home:Vogtinator:branches:KDE:Extra
- Add patches to support libjxl >= 0.9.0: * 0001-Fix-build-with-libjxl-0.9.0.patch * 0002-KisFileIconCreator-add-workaround-for-JPEG-XL-too.patch * 0003-JPEG-XL-Disable-export-bug-workaround-for-libjxl-0.9.patch OBS-URL: https://build.opensuse.org/request/show/1139885 OBS-URL: https://build.opensuse.org/package/show/KDE:Extra/krita?expand=0&rev=193
This commit is contained in:
parent
6e87738994
commit
ce2af6d313
95
0001-Fix-build-with-libjxl-0.9.0.patch
Normal file
95
0001-Fix-build-with-libjxl-0.9.0.patch
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
From 0bb4659b49ba3086cb757bd5db1839a91db9ffa9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Timo Gurr <timo.gurr@gmail.com>
|
||||||
|
Date: Fri, 5 Jan 2024 14:04:50 +0000
|
||||||
|
Subject: [PATCH 1/3] Fix build with libjxl 0.9.0
|
||||||
|
|
||||||
|
Fix build with libjxl 0.9.0
|
||||||
|
|
||||||
|
BUG:478987
|
||||||
|
|
||||||
|
Test Plan
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Upgrade to libjxl 0.9.0
|
||||||
|
* Apply patch from MR and build krita (5.2.2)
|
||||||
|
* Open/Display a sample image e.g. https://jpegxl.info/test-page/red-room.jxl
|
||||||
|
|
||||||
|
Formalities Checklist
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
- [x] I confirmed this builds.
|
||||||
|
- [x] I confirmed Krita ran and the relevant functions work (Could successfully open/display a sample image https://jpegxl.info/test-page/red-room.jxl).
|
||||||
|
- [ ] I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
|
||||||
|
- [x] I made sure my commits build individually and have good descriptions as per [KDE guidelines](https://community.kde.org/Policies/Commit_Policy).
|
||||||
|
- [x] I made sure my code conforms to the standards set in the HACKING file.
|
||||||
|
- [x] I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per [KDE Licensing Policy](https://community.kde.org/Policies/Licensing_Policy).
|
||||||
|
|
||||||
|
_**Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build.**_
|
||||||
|
_**If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.**_
|
||||||
|
|
||||||
|
(cherry picked from commit ace7edcca6ad322581ab39620f21ccf3ffbd3b5a)
|
||||||
|
---
|
||||||
|
plugins/impex/jxl/JPEGXLImport.cpp | 15 ++++++++++++++-
|
||||||
|
1 file changed, 14 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/plugins/impex/jxl/JPEGXLImport.cpp b/plugins/impex/jxl/JPEGXLImport.cpp
|
||||||
|
index 573bae412473..f5b989b3b704 100644
|
||||||
|
--- a/plugins/impex/jxl/JPEGXLImport.cpp
|
||||||
|
+++ b/plugins/impex/jxl/JPEGXLImport.cpp
|
||||||
|
@@ -511,7 +511,9 @@ JPEGXLImport::convert(KisDocument *document, QIODevice *io, KisPropertiesConfigu
|
||||||
|
JxlColorEncoding colorEncoding{};
|
||||||
|
if (JXL_DEC_SUCCESS
|
||||||
|
== JxlDecoderGetColorAsEncodedProfile(dec.get(),
|
||||||
|
+#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
|
||||||
|
nullptr,
|
||||||
|
+#endif
|
||||||
|
JXL_COLOR_PROFILE_TARGET_DATA,
|
||||||
|
&colorEncoding)) {
|
||||||
|
const TransferCharacteristics transferFunction = [&]() {
|
||||||
|
@@ -635,7 +637,12 @@ JPEGXLImport::convert(KisDocument *document, QIODevice *io, KisPropertiesConfigu
|
||||||
|
size_t iccSize = 0;
|
||||||
|
QByteArray iccProfile;
|
||||||
|
if (JXL_DEC_SUCCESS
|
||||||
|
- != JxlDecoderGetICCProfileSize(dec.get(), nullptr, JXL_COLOR_PROFILE_TARGET_DATA, &iccSize)) {
|
||||||
|
+ != JxlDecoderGetICCProfileSize(dec.get(),
|
||||||
|
+#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0,9,0)
|
||||||
|
+ nullptr,
|
||||||
|
+#endif
|
||||||
|
+ JXL_COLOR_PROFILE_TARGET_DATA,
|
||||||
|
+ &iccSize)) {
|
||||||
|
errFile << "ICC profile size retrieval failed";
|
||||||
|
document->setErrorMessage(i18nc("JPEG-XL errors", "Unable to read the image profile."));
|
||||||
|
return ImportExportCodes::ErrorWhileReading;
|
||||||
|
@@ -643,7 +650,9 @@ JPEGXLImport::convert(KisDocument *document, QIODevice *io, KisPropertiesConfigu
|
||||||
|
iccProfile.resize(static_cast<int>(iccSize));
|
||||||
|
if (JXL_DEC_SUCCESS
|
||||||
|
!= JxlDecoderGetColorAsICCProfile(dec.get(),
|
||||||
|
+#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0,9,0)
|
||||||
|
nullptr,
|
||||||
|
+#endif
|
||||||
|
JXL_COLOR_PROFILE_TARGET_DATA,
|
||||||
|
reinterpret_cast<uint8_t *>(iccProfile.data()),
|
||||||
|
static_cast<size_t>(iccProfile.size()))) {
|
||||||
|
@@ -657,7 +666,9 @@ JPEGXLImport::convert(KisDocument *document, QIODevice *io, KisPropertiesConfigu
|
||||||
|
if (!d.m_info.uses_original_profile) {
|
||||||
|
if (JXL_DEC_SUCCESS
|
||||||
|
!= JxlDecoderGetICCProfileSize(dec.get(),
|
||||||
|
+#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0,9,0)
|
||||||
|
nullptr,
|
||||||
|
+#endif
|
||||||
|
JXL_COLOR_PROFILE_TARGET_ORIGINAL,
|
||||||
|
&iccTargetSize)) {
|
||||||
|
errFile << "ICC profile size retrieval failed";
|
||||||
|
@@ -667,7 +678,9 @@ JPEGXLImport::convert(KisDocument *document, QIODevice *io, KisPropertiesConfigu
|
||||||
|
iccTargetProfile.resize(static_cast<int>(iccTargetSize));
|
||||||
|
if (JXL_DEC_SUCCESS
|
||||||
|
!= JxlDecoderGetColorAsICCProfile(dec.get(),
|
||||||
|
+#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0,9,0)
|
||||||
|
nullptr,
|
||||||
|
+#endif
|
||||||
|
JXL_COLOR_PROFILE_TARGET_ORIGINAL,
|
||||||
|
reinterpret_cast<uint8_t *>(iccTargetProfile.data()),
|
||||||
|
static_cast<size_t>(iccTargetProfile.size()))) {
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
33
0002-KisFileIconCreator-add-workaround-for-JPEG-XL-too.patch
Normal file
33
0002-KisFileIconCreator-add-workaround-for-JPEG-XL-too.patch
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
From c12b77a6a6941fabc750a590159c7f9d98776ee4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Rasyuqa A. H." <qampidh@gmail.com>
|
||||||
|
Date: Sat, 6 Jan 2024 02:50:10 +0700
|
||||||
|
Subject: [PATCH 2/3] KisFileIconCreator: add workaround for JPEG XL too
|
||||||
|
|
||||||
|
KImageFormats / QImage can crash if we update libjxl to >= 0.9.0 due to API changes.
|
||||||
|
On Krita, this can result in crash whenever the thumbnail loads in welcome screen.
|
||||||
|
|
||||||
|
This patch also enables thumbnail generation for JXL as well.
|
||||||
|
|
||||||
|
(cherry picked from commit 1da5a7a6c2b2be5ec5e04c39a9a8663696d2b367)
|
||||||
|
---
|
||||||
|
libs/ui/utils/KisFileIconCreator.cpp | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/libs/ui/utils/KisFileIconCreator.cpp b/libs/ui/utils/KisFileIconCreator.cpp
|
||||||
|
index 17d0e482301a..25dd82d1fb09 100644
|
||||||
|
--- a/libs/ui/utils/KisFileIconCreator.cpp
|
||||||
|
+++ b/libs/ui/utils/KisFileIconCreator.cpp
|
||||||
|
@@ -112,8 +112,9 @@ bool KisFileIconCreator::createFileIcon(QString path, QIcon &icon, qreal deviceP
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
- } else if (mimeType == "image/tiff" || mimeType == "image/x-tiff") {
|
||||||
|
+ } else if (mimeType == "image/tiff" || mimeType == "image/x-tiff" || mimeType == "image/jxl") {
|
||||||
|
// Workaround for a bug in Qt tiff QImageIO plugin
|
||||||
|
+ // XXX: Also for JPEG-XL if KImageFormats haven't updated to accomodate libjxl >= v0.9.0 API changes.
|
||||||
|
QScopedPointer<KisDocument> doc(KisPart::instance()->createTemporaryDocument());
|
||||||
|
doc->setFileBatchMode(true);
|
||||||
|
bool r = doc->openPath(path, KisDocument::DontAddToRecent);
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
@ -0,0 +1,36 @@
|
|||||||
|
From b299812aaf8b79223b4523a43c1427e343b2e753 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Rasyuqa A. H." <qampidh@gmail.com>
|
||||||
|
Date: Mon, 8 Jan 2024 17:48:34 +0700
|
||||||
|
Subject: [PATCH 3/3] JPEG-XL: Disable export bug workaround for libjxl >=
|
||||||
|
0.9.0
|
||||||
|
|
||||||
|
(cherry picked from commit 546765dfd396a4bb482b98a7b6ca22f1dca809af)
|
||||||
|
---
|
||||||
|
plugins/impex/jxl/JPEGXLExport.cpp | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/plugins/impex/jxl/JPEGXLExport.cpp b/plugins/impex/jxl/JPEGXLExport.cpp
|
||||||
|
index e0d22f0d298a..f662cf4476cd 100644
|
||||||
|
--- a/plugins/impex/jxl/JPEGXLExport.cpp
|
||||||
|
+++ b/plugins/impex/jxl/JPEGXLExport.cpp
|
||||||
|
@@ -832,14 +832,16 @@ KisImportExportErrorCode JPEGXLExport::convert(KisDocument *document, QIODevice
|
||||||
|
}();
|
||||||
|
|
||||||
|
// XXX: Workaround for a buggy lossless patches. Set to disable instead.
|
||||||
|
- // TODO Kampidh: revisit this when upstream got fixed.
|
||||||
|
+ // Patch only for libjxl under v0.9.0
|
||||||
|
//
|
||||||
|
// See: https://github.com/libjxl/libjxl/issues/2463
|
||||||
|
const int setPatches = [&]() -> int {
|
||||||
|
+#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
|
||||||
|
if ((cfg->getInt("effort", 7) > 4) && !cfg->getBool("flattenLayers", true)) {
|
||||||
|
warnFile << "Using workaround for layer exports, disabling patches option on effort > 4";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
return cfg->getInt("patches", -1);
|
||||||
|
}();
|
||||||
|
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jan 19 09:40:36 UTC 2024 - Fabian Vogt <fabian@ritter-vogt.de>
|
||||||
|
|
||||||
|
- Add patches to support libjxl >= 0.9.0:
|
||||||
|
* 0001-Fix-build-with-libjxl-0.9.0.patch
|
||||||
|
* 0002-KisFileIconCreator-add-workaround-for-JPEG-XL-too.patch
|
||||||
|
* 0003-JPEG-XL-Disable-export-bug-workaround-for-libjxl-0.9.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Dec 18 11:28:45 UTC 2023 - Christophe Marin <christophe@krop.fr>
|
Mon Dec 18 11:28:45 UTC 2023 - Christophe Marin <christophe@krop.fr>
|
||||||
|
|
||||||
|
10
krita.spec
10
krita.spec
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package krita
|
# spec file for package krita
|
||||||
#
|
#
|
||||||
# Copyright (c) 2023 SUSE LLC
|
# Copyright (c) 2024 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -42,6 +42,10 @@ Source0: https://download.kde.org/stable/krita/%{version}/krita-%{version
|
|||||||
Source1: https://download.kde.org/stable/krita/%{version}/krita-%{version}.tar.xz.sig
|
Source1: https://download.kde.org/stable/krita/%{version}/krita-%{version}.tar.xz.sig
|
||||||
Source2: krita.keyring
|
Source2: krita.keyring
|
||||||
%endif
|
%endif
|
||||||
|
# PATCH-FIX-UPSTREAM
|
||||||
|
Patch1: 0001-Fix-build-with-libjxl-0.9.0.patch
|
||||||
|
Patch2: 0002-KisFileIconCreator-add-workaround-for-JPEG-XL-too.patch
|
||||||
|
Patch3: 0003-JPEG-XL-Disable-export-bug-workaround-for-libjxl-0.9.patch
|
||||||
BuildRequires: OpenEXR-devel
|
BuildRequires: OpenEXR-devel
|
||||||
BuildRequires: extra-cmake-modules
|
BuildRequires: extra-cmake-modules
|
||||||
BuildRequires: fftw3-devel
|
BuildRequires: fftw3-devel
|
||||||
@ -53,6 +57,7 @@ BuildRequires: libboost_system-devel
|
|||||||
BuildRequires: libboost_system1_75_0-devel
|
BuildRequires: libboost_system1_75_0-devel
|
||||||
#!BuildIgnore: libboost_headers1_66_0-devel
|
#!BuildIgnore: libboost_headers1_66_0-devel
|
||||||
%endif
|
%endif
|
||||||
|
BuildRequires: libQt5Gui-private-headers-devel
|
||||||
BuildRequires: libeigen3-devel
|
BuildRequires: libeigen3-devel
|
||||||
BuildRequires: libexiv2-devel
|
BuildRequires: libexiv2-devel
|
||||||
BuildRequires: libheif-devel
|
BuildRequires: libheif-devel
|
||||||
@ -60,7 +65,6 @@ BuildRequires: libjpeg-devel
|
|||||||
BuildRequires: liblcms2-devel
|
BuildRequires: liblcms2-devel
|
||||||
BuildRequires: libpng-devel
|
BuildRequires: libpng-devel
|
||||||
BuildRequires: libpoppler-qt5-devel
|
BuildRequires: libpoppler-qt5-devel
|
||||||
BuildRequires: libQt5Gui-private-headers-devel
|
|
||||||
BuildRequires: libraw-devel
|
BuildRequires: libraw-devel
|
||||||
BuildRequires: libtiff-devel
|
BuildRequires: libtiff-devel
|
||||||
BuildRequires: openjpeg2-devel
|
BuildRequires: openjpeg2-devel
|
||||||
@ -119,8 +123,8 @@ BuildRequires: pkgconfig(harfbuzz) >= 4.0
|
|||||||
BuildRequires: pkgconfig(libmypaint)
|
BuildRequires: pkgconfig(libmypaint)
|
||||||
BuildRequires: pkgconfig(libunibreak)
|
BuildRequires: pkgconfig(libunibreak)
|
||||||
BuildRequires: pkgconfig(libwebp)
|
BuildRequires: pkgconfig(libwebp)
|
||||||
BuildRequires: pkgconfig(xcb-xinput)
|
|
||||||
BuildRequires: pkgconfig(xcb-atom)
|
BuildRequires: pkgconfig(xcb-atom)
|
||||||
|
BuildRequires: pkgconfig(xcb-xinput)
|
||||||
BuildRequires: pkgconfig(xi) >= 1.4.99.1
|
BuildRequires: pkgconfig(xi) >= 1.4.99.1
|
||||||
%if %{with python}
|
%if %{with python}
|
||||||
Recommends: python3-qt5
|
Recommends: python3-qt5
|
||||||
|
Loading…
Reference in New Issue
Block a user