On Sun Mar 17, 2024 at 10:33:02PM +0100, Matthias Kilian wrote:
> Hi,
> 
> this fixes inkscape with poppler-24.03.0. Tested on amd64 by importing
> some PDFs with inkscape.
> 
> ok?

There is no sadowski@, OK to fix inkscape with poppler-24.03.

OK rsadowski

> 
> Ciao,
>       Kil
> 
> Index: patches/patch-src_extension_internal_pdfinput_svg-builder_cpp
> ===================================================================
> RCS file: patches/patch-src_extension_internal_pdfinput_svg-builder_cpp
> diff -N patches/patch-src_extension_internal_pdfinput_svg-builder_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_extension_internal_pdfinput_svg-builder_cpp     17 Mar 
> 2024 19:39:49 -0000
> @@ -0,0 +1,38 @@
> +Fix build with poppler-24.03.
> +
> +From https://gitlab.com/inkscape/inkscape/-/merge_requests/6209/diffs
> +(without any preprocessor conditionals)
> +
> +Index: src/extension/internal/pdfinput/svg-builder.cpp
> +--- src/extension/internal/pdfinput/svg-builder.cpp.orig
> ++++ src/extension/internal/pdfinput/svg-builder.cpp
> +@@ -1158,9 +1158,9 @@ static bool svgGetShadingColor(GfxShading *shading, do
> + #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 == Function::Type::Sampled || type == 
> Function::Type::Exponential ) {  // Sampled or exponential function
> +         GfxColor stop1, stop2;
> +         if (!svgGetShadingColor(shading, 0.0, &stop1) || 
> !svgGetShadingColor(shading, 1.0, &stop2)) {
> +             return false;
> +@@ -1168,7 +1168,7 @@ bool SvgBuilder::_addGradientStops(Inkscape::XML::Node
> +             _addStopToGradient(gradient, 0.0, &stop1, space, 1.0);
> +             _addStopToGradient(gradient, 1.0, &stop2, space, 1.0);
> +         }
> +-    } else if ( type == 3 ) { // Stitching
> ++    } else if ( type == Function::Type::Stitching ) { // 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(Inkscape::XML::Node
> +         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() == 
> Function::Type::Exponential) {    // process exponential fxn
> +                 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

Reply via email to