Poppler/cairo import incorrectly transforms transparent gradients in pdf created with cairo > 1.11.4

Reported in https://bugs.launchpad.net/inkscape/+bug/1078430 , highly related to #3281 (moved) (internal import).

Summary:

  • poppler/cairo import incorrectly converts transparent gradients of PDFs to SVG (created by Inkscape export, cairo >= 1.11.4, saving as pdf or printing to pdf via GTK+ print dialog)

Steps to reproduce:

  • open Inkscape
  • open this svg or create a rectangle and give it a gradient (should be #0000ffff to #0000ff00 by default)
  • save as pdf (1.4 or 1.5, default values)
  • open created pdf in Inkscape (poppler/cairo import)

What happened?

  • The gradient fills are displaced and partially clipped off
  • If you look at the radial gradient, it is the proper size (see the mask), but the transform stretches the gradient into the wrong shape.

What should have happened?

  • The gradient fills in original SVG and opened PDF look identical (or at least very similar)

Pdfs affected

Affects newer versions of cairo
  • problematic pdfs created (by su_v) with cairo 1.12.4, 1.12.6 and 1.12.8 on OS X 10.7.4 (64bit) with GTK+/Quartz builds of Inkscape 0.48.3.1 and Inkscape 0.48+devel r11871.
  • unproblematic pdfs created (by su_v) with cairo (all <= 1.12.2) 1.8.8, 1.8.10 and 1.10.2 on all official Mac OS X Inkscape packages >= 0.47 (in 2012-11-13)
  • unproblematic pdfs created (by su_v) with cairo 1.10.2 (X11), 1.11.4 (Quartz) with local builds on Mac OS X 10.5.8 (32bit)
  • rsvg-convert pdfs
pdf rendered in pdf viewers Problematic pdf (created with cairo 1.12.8)
  • crashed/segfaulted xpdf 3.03 on Ubuntu (does not segfault 3.04-7 on Linux Mint 19.1).
  • rendered with solid fill colors instead of gradient fills on Ghostscript 9.05 on OS X
  • rendered normally on Evince 2.30.3 (OS X), 3.6.0 (Ubuntu 12.10), Xpdf 3.02 (OS X), Ghostscript 9.06 (Ubuntu 12.10) and Apple's Preview.app (OS X)
Doesn't affect
  • pdfs created with libcairo 1.11.4 or older
    • unproblematic pdfs created (by su_v) with cairo 1.12.2 (X11) with local builds on OS X 10.7.4 (64bit)
    • unproblematic pdfs created (by su_v) with cairo 1.12.2 on a Ubuntu 12.10 x64 VM
  • fully opaque gradients, but these imports in a completely different way (transparent gradients are separated into opaque gradient and a mask with a transparency gradient)

Example files

inkscape-popplercairo-import-gradient-comparison

Version Info:

  • Reproduced Inkscape 1.1-dev (838ae0f22d, 2020-07-14, custom) Linux Mint 19.1, libcairo2 1.15.10-2ubuntu0.1
  • Reproduced Inkscape 0.92.5 (6c0c36ef5a, 2020-05-15) Linux Mint 19.1, libcairo2 1.15.10-2ubuntu0.1
  • Reproduced Inkscape 0.91 r13725 on Kubuntu (from launchpad)
  • Reproduced Inkscape trunk r11871 on Mac OS X 10.5.8 (32bit), OS X 10.7.4 (64bit) and Ubuntu 12.10 (64bit, VM) (from launchpad)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information