From 970adddbfc48d143ebaae950543ddbfcb6eb25c5 Mon Sep 17 00:00:00 2001
From: Andreas Wacknitz <A.Wacknitz@gmx.de>
Date: Fri, 29 Mar 2024 23:01:14 +0100
Subject: [PATCH] rebuild sane-backends

---
 components/image/inkscape/patches/12-fix-libpoppler.patch |   76 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/components/image/inkscape/patches/12-fix-libpoppler.patch b/components/image/inkscape/patches/12-fix-libpoppler.patch
new file mode 100644
index 0000000..bc5a98c
--- /dev/null
+++ b/components/image/inkscape/patches/12-fix-libpoppler.patch
@@ -0,0 +1,76 @@
+From f7e944575ea5247952d23f85dfa905cfa13f7b28 Mon Sep 17 00:00:00 2001
+From: Andreas Sturmlechner <asturm@gentoo.org>
+Date: Mon, 4 Mar 2024 22:59:40 +0100
+Subject: [PATCH] Fix build with >=poppler-24.03.0
+
+Fixes build errors caused by:
+
+"Use an enum for Function getType"
+Upstream commit 6e3824d45d42cb806a28a2df84e4ab6bb3587083
+
+Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
+
+Fixes https://gitlab.com/inkscape/inkscape/-/issues/4787
+---
+ .../internal/pdfinput/poppler-transition-api.h         | 10 ++++++++++
+ src/extension/internal/pdfinput/svg-builder.cpp        |  8 ++++----
+ 2 files changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h
+index 66b15d705a2..58aa1ec921d 100644
+--- a/src/extension/internal/pdfinput/poppler-transition-api.h
++++ b/src/extension/internal/pdfinput/poppler-transition-api.h
+@@ -14,6 +14,16 @@
+ 
+ #include <glib/poppler-features.h>
+ 
++#if POPPLER_CHECK_VERSION(24, 3, 0)
++#define _POPPLER_FUNCTION_TYPE_SAMPLED Function::Type::Sampled
++#define _POPPLER_FUNCTION_TYPE_EXPONENTIAL Function::Type::Exponential
++#define _POPPLER_FUNCTION_TYPE_STITCHING Function::Type::Stitching
++#else
++#define _POPPLER_FUNCTION_TYPE_SAMPLED 0
++#define _POPPLER_FUNCTION_TYPE_EXPONENTIAL 2
++#define _POPPLER_FUNCTION_TYPE_STITCHING 3
++#endif
++
+ #if POPPLER_CHECK_VERSION(22, 4, 0)
+ #define _POPPLER_FONTPTR_TO_GFX8(font_ptr) ((Gfx8BitFont *)font_ptr.get())
+ #else
+diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
+index 525fbfec0a8..f0a9c1ac696 100644
+--- a/src/extension/internal/pdfinput/svg-builder.cpp
++++ b/src/extension/internal/pdfinput/svg-builder.cpp
+@@ -1175,9 +1175,9 @@ static bool svgGetShadingColor(GfxShading *shading, double offset, GfxColor *res
+ #define INT_EPSILON 8
+ bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *shading,
+                                    _POPPLER_CONST Function *func) {
+-    int type = func->getType();
++    auto type = func->getType();
+     auto space = shading->getColorSpace();
+-    if ( type == 0 || type == 2 ) {  // Sampled or exponential function
++    if (type == _POPPLER_FUNCTION_TYPE_SAMPLED || type == _POPPLER_FUNCTION_TYPE_EXPONENTIAL) {
+         GfxColor stop1, stop2;
+         if (!svgGetShadingColor(shading, 0.0, &stop1) || !svgGetShadingColor(shading, 1.0, &stop2)) {
+             return false;
+@@ -1185,7 +1185,7 @@ bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *sh
+             _addStopToGradient(gradient, 0.0, &stop1, space, 1.0);
+             _addStopToGradient(gradient, 1.0, &stop2, space, 1.0);
+         }
+-    } else if ( type == 3 ) { // Stitching
++    } else if (type == _POPPLER_FUNCTION_TYPE_STITCHING) {
+         auto stitchingFunc = static_cast<_POPPLER_CONST StitchingFunction*>(func);
+         const double *bounds = stitchingFunc->getBounds();
+         const double *encode = stitchingFunc->getEncode();
+@@ -1200,7 +1200,7 @@ bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *sh
+         for ( int i = 0 ; i < num_funcs ; i++ ) {
+             svgGetShadingColor(shading, bounds[i + 1], &color);
+             // Add stops
+-            if (stitchingFunc->getFunc(i)->getType() == 2) {    // process exponential fxn
++            if (stitchingFunc->getFunc(i)->getType() == _POPPLER_FUNCTION_TYPE_EXPONENTIAL) {
+                 double expE = (static_cast<_POPPLER_CONST ExponentialFunction*>(stitchingFunc->getFunc(i)))->getE();
+                 if (expE > 1.0) {
+                     expE = (bounds[i + 1] - bounds[i])/expE;    // approximate exponential as a single straight line at x=1
+-- 
+GitLab
+

--
Gitblit v1.9.3