File inkscape-poppler-24.03.0.patch of Package inkscape

Upstream commit 6e3824d45d42cb806a28a2df84e4ab6bb3587083

Backport for 1.2.2


--- a/src/extension/internal/pdfinput/svg-builder.cpp.orig	2022-11-26 18:42:01.000000000 +0100
+++ b/src/extension/internal/pdfinput/svg-builder.cpp	2024-08-06 17:35:03.563813940 +0200
@@ -923,8 +923,12 @@
 #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();
+#if POPPLER_CHECK_VERSION(24, 3, 0)
+    if ( type == Function::Type::Sampled || type == Function::Type::Exponential ) {  // Sampled or exponential function
+#else
     if ( type == 0 || type == 2 ) {  // Sampled or exponential function
+#endif
         GfxRGB stop1, stop2;
         if ( !svgGetShadingColorRGB(shading, 0.0, &stop1) ||
              !svgGetShadingColorRGB(shading, 1.0, &stop2) ) {
@@ -933,7 +937,11 @@
             _addStopToGradient(gradient, 0.0, &stop1, 1.0);
             _addStopToGradient(gradient, 1.0, &stop2, 1.0);
         }
+#if POPPLER_CHECK_VERSION(24, 3, 0)
+    } else if ( type == Function::Type::Stitching ) { // Stitching
+#else
     } else if ( type == 3 ) { // Stitching
+#endif
         auto stitchingFunc = static_cast<_POPPLER_CONST StitchingFunction*>(func);
         const double *bounds = stitchingFunc->getBounds();
         const double *encode = stitchingFunc->getEncode();
@@ -946,7 +954,11 @@
         for ( int i = 0 ; i < num_funcs ; i++ ) {
             svgGetShadingColorRGB(shading, bounds[i + 1], &color);
             // Add stops
+#if POPPLER_CHECK_VERSION(24, 3, 0)
+            if (stitchingFunc->getFunc(i)->getType() == Function::Type::Exponential) {    // process exponential fxn
+#else
             if (stitchingFunc->getFunc(i)->getType() == 2) {    // process exponential fxn
+#endif
                 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
openSUSE Build Service is sponsored by