summaryrefslogtreecommitdiff
path: root/inkscape/inkscape-1.2.1-poppler-22.09.0.patch
blob: 168845814efff3640e29d5f464504cd5360af111 (plain)
    1 From fb00794923d19cfbb2ca4adca3ae8971553a06be Mon Sep 17 00:00:00 2001
    2 From: Sam James <sam@gentoo.org>
    3 Date: Fri, 2 Sep 2022 06:21:28 +0100
    4 Subject: [PATCH] Fix build with Poppler 22.09.0
    5 MIME-Version: 1.0
    6 Content-Type: text/plain; charset=UTF-8
    7 Content-Transfer-Encoding: 8bit
    8 
    9 With Poppler 22.09.0, inkscape fails to build with:
   10 ```
   11 /var/tmp/portage/media-gfx/inkscape-1.2.1/work/inkscape-1.2.1/src/extension/internal/pdfinput/svg-builder.cpp:394:23: error: no matching function for call to ‘GfxState::getLineDash(double**, int*, double*)’
   12   394 |     state->getLineDash(&dash_pattern, &dash_length, &dash_start);
   13       |     ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   14 In file included from /var/tmp/portage/media-gfx/inkscape-1.2.1/work/inkscape-1.2.1/src/extension/internal/pdfinput/svg-builder.cpp:44:
   15 /usr/include/poppler/GfxState.h:1506:32: note: candidate: ‘const std::vector<double>& GfxState::getLineDash(double*)’
   16  1506 |     const std::vector<double> &getLineDash(double *start)
   17       |                                ^~~~~~~~~~~
   18 [...]
   19 /var/tmp/portage/media-gfx/inkscape-1.2.1/work/inkscape-1.2.1/src/extension/internal/pdfinput/pdf-parser.cpp:700:21: error: no matching function for call to ‘GfxState::setLineDash(double*&, int&, double)’
   20   700 |   state->setLineDash(dash, length, args[1].getNum());
   21       |   ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   22 ```
   23 
   24 Poppler changed the getLineDash interface:
   25 ```
   26 -    void getLineDash(double **dash, int *length, double *start)
   27 +    const std::vector<double> &getLineDash(double *start)
   28 ```
   29 
   30 ... and the setLineDash interface:
   31 ````
   32 -    void setLineDash(double *dash, int length, double start);
   33 +    void setLineDash(std::vector<double> &&dash, double start);
   34 ```
   35 
   36 Signed-off-by: Sam James <sam@gentoo.org>
   37 ---
   38  src/extension/internal/pdfinput/pdf-parser.cpp  | 4 ++++
   39  src/extension/internal/pdfinput/svg-builder.cpp | 9 ++++++++-
   40  2 files changed, 12 insertions(+), 1 deletion(-)
   41 
   42 diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
   43 index cca1e84096..80d64c9b86 100644
   44 --- a/src/extension/internal/pdfinput/pdf-parser.cpp
   45 +++ b/src/extension/internal/pdfinput/pdf-parser.cpp
   46 @@ -697,7 +697,11 @@ void PdfParser::opSetDash(Object args[], int /*numArgs*/)
   47        _POPPLER_FREE(obj);
   48      }
   49    }
   50 +#if POPPLER_CHECK_VERSION(22, 9, 0)
   51 +  state->setLineDash(std::vector<double> (dash, dash + length), args[1].getNum());
   52 +#else
   53    state->setLineDash(dash, length, args[1].getNum());
   54 +#endif
   55    builder->updateStyle(state);
   56  }
   57  
   58 diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
   59 index 12f71dd921..9fc56fe63c 100644
   60 --- a/src/extension/internal/pdfinput/svg-builder.cpp
   61 +++ b/src/extension/internal/pdfinput/svg-builder.cpp
   62 @@ -389,10 +389,17 @@ void SvgBuilder::_setStrokeStyle(SPCSSAttr *css, GfxState *state) {
   63      sp_repr_css_set_property(css, "stroke-miterlimit", os_ml.str().c_str());
   64  
   65      // Line dash
   66 -    double *dash_pattern;
   67      int dash_length;
   68      double dash_start;
   69 +#if POPPLER_CHECK_VERSION(22, 9, 0)
   70 +    const double *dash_pattern;
   71 +    const std::vector<double> &dash = state->getLineDash(&dash_start);
   72 +    dash_pattern = dash.data();
   73 +    dash_length = dash.size();
   74 +#else
   75 +    double *dash_pattern;
   76      state->getLineDash(&dash_pattern, &dash_length, &dash_start);
   77 +#endif
   78      if ( dash_length > 0 ) {
   79          Inkscape::CSSOStringStream os_array;
   80          for ( int i = 0 ; i < dash_length ; i++ ) {
   81 -- 
   82 GitLab

Generated by cgit