Submitted By: Douglas R. Reno Date: 2024-04-01 Initial Package Version: 1.3.2 Origin: Upstream (!6209) Upstream Status: Applied Description: Fixes building Inkscape with poppler-24.03.0 by adapting to the poppler commit "Use an enum for Function getType." This patch maintains compatibility with previous versions of poppler as well for users who are using previous versions. diff -Naurp inkscape-1.3.2_2023-11-25_091e20ef0f.orig/src/extension/internal/pdfinput/poppler-transition-api.h inkscape-1.3.2_2023-11-25_091e20ef0f/src/extension/internal/pdfinput/poppler-transition-api.h --- inkscape-1.3.2_2023-11-25_091e20ef0f.orig/src/extension/internal/pdfinput/poppler-transition-api.h 2024-04-01 11:55:41.958922919 -0500 +++ inkscape-1.3.2_2023-11-25_091e20ef0f/src/extension/internal/pdfinput/poppler-transition-api.h 2024-04-01 11:57:00.684532596 -0500 @@ -14,6 +14,16 @@ #include +#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 -Naurp inkscape-1.3.2_2023-11-25_091e20ef0f.orig/src/extension/internal/pdfinput/svg-builder.cpp inkscape-1.3.2_2023-11-25_091e20ef0f/src/extension/internal/pdfinput/svg-builder.cpp --- inkscape-1.3.2_2023-11-25_091e20ef0f.orig/src/extension/internal/pdfinput/svg-builder.cpp 2024-04-01 11:55:41.958922919 -0500 +++ inkscape-1.3.2_2023-11-25_091e20ef0f/src/extension/internal/pdfinput/svg-builder.cpp 2024-04-01 11:58:30.087087014 -0500 @@ -1158,9 +1158,9 @@ static bool svgGetShadingColor(GfxShadin #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; @@ -1168,7 +1168,7 @@ bool SvgBuilder::_addGradientStops(Inksc _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(); @@ -1183,7 +1183,7 @@ bool SvgBuilder::_addGradientStops(Inksc 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