Bug 99562 - Error rasterization of SVG gradients
Summary: Error rasterization of SVG gradients
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
5.2.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Xisco Faulí
URL:
Whiteboard: target:24.2.0 target:7.6.0.2
Keywords: bibisected, bisected, regression
: 127376 136492 146009 (view as bug list)
Depends on:
Blocks: SVG-Import SVG-filters
  Show dependency treegraph
 
Reported: 2016-04-29 08:51 UTC by ape
Modified: 2023-07-10 12:44 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
insert SVG (533.19 KB, image/svg+xml)
2016-04-29 08:51 UTC, ape
Details
Inkscape-LibO_3.6.7-LibO_5.2.0.0 snapshot (119.26 KB, image/png)
2016-04-29 09:25 UTC, ape
Details
bad SVG gradients (64.39 KB, image/png)
2017-05-31 16:01 UTC, ape
Details
min document (4.70 KB, image/svg+xml)
2019-09-20 14:17 UTC, Xisco Faulí
Details
How the image looks like before my patch (15.56 KB, image/png)
2019-09-20 15:55 UTC, Xisco Faulí
Details
LibreOffice 7.3 vs Firefox vs Chrome (97.80 KB, image/png)
2021-12-02 16:52 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ape 2016-04-29 08:51:49 UTC
Created attachment 124712 [details]
insert SVG

Version: 5.2.0.0.alpha1
Build ID: 902b28a39528b6c92602e9b521a1d0861be1caf9
CPU Threads: 2; OS Version: Windows 5.2; UI Render: default; 
Locale: ru-RU (ru_RU)
--
1. Start LibreOfficeDev (Writer or Draw or Inpress).
2. Click Insert > Image…
3. Insert the attached file.
4. See: raster gradient has an error.
Comment 1 ape 2016-04-29 09:25:56 UTC
Created attachment 124716 [details]
Inkscape-LibO_3.6.7-LibO_5.2.0.0 snapshot

LibreOffice_3.6.7.2 shows the SVG file correctly. This is regression.
Comment 2 Buovjaga 2016-05-06 13:26:33 UTC
Yeah.

Arch Linux 64-bit, KDE Plasma 5
Version: 5.2.0.0.alpha1+
Build ID: 540fee2dc7553152914f7f1d8a41921e765087ef
CPU Threads: 8; OS Version: Linux 4.5; UI Render: default; 
Locale: fi-FI (fi_FI.UTF-8)
Built on April 30th 2016
Comment 3 raal 2016-05-10 05:01:42 UTC
Hello Xisco,
this SVG was broken in 5.2-oldest and your commit repaired it, please could you look also at this problem? Thanks
 25d47718f1d223a8d616a765c4d19a40fa0aab98 is the first bad commit
commit 25d47718f1d223a8d616a765c4d19a40fa0aab98
Author: Norbert Thiebaud <nthiebaud@gmail.com>
Date:   Fri Mar 18 11:13:50 2016 -0700

    source ecc7f698b5f080530f006218fa3dd82da43d9abb

author	Xisco Fauli <anistenis@gmail.com>	2016-03-07 22:05:59 (GMT)
committer	Noel Grandin <noelgrandin@gmail.com>	2016-03-09 08:51:27 (GMT)
commit ecc7f698b5f080530f006218fa3dd82da43d9abb (patch)
tree 54307f8f7cc17c2d39dc63c530bb76def03a3e7f
parent 49b78749b1323dc7978d15135bc42646cb0db719 (diff)
SVGIO: Fix problem when style's parent contains a mask element
Comment 4 Xisco Faulí 2016-09-26 15:24:40 UTC
Adding Cc: to Xisco Fauli
Comment 5 ape 2017-02-18 19:10:56 UTC
I confirm this bug:

Version: 5.4.0.0.alpha0+
Build ID: 0cd819b68ced2a95a127a246c0558153fbdbcae2
CPU Threads: 8; OS Version: Windows 5.2; UI Render: default; 
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2017-01-31_12:28:03
Locale: ru-RU (ru_RU); Calc: group
Comment 6 ape 2017-05-31 16:01:02 UTC
Created attachment 133751 [details]
bad SVG gradients

I confirm bug.

OS: Lubuntu 16.04 LTS

Версия: 5.4.0.0.beta1
ID сборки: 8672113ead4e403c55e31b1d9a3d1e0f3b299577
CPU threads: 4; OS: Linux 4.4; UI render: по умолчанию; VCL: gtk2; 
Локаль: ru-RU (ru_RU.UTF-8); Calc: group
Comment 7 Roman Kuznetsov 2018-06-20 13:45:04 UTC
still repro in LibreOffice 6.1 beta 2
Comment 8 QA Administrators 2019-06-21 02:53:18 UTC Comment hidden (obsolete)
Comment 9 Xisco Faulí 2019-09-16 19:00:40 UTC
The problem is the masks use URL in their styles.
My commit just arose an previous existing problem. See bug 94765

*** This bug has been marked as a duplicate of bug 94765 ***
Comment 10 Xisco Faulí 2019-09-19 08:37:07 UTC
(In reply to Xisco Faulí from comment #9)
> The problem is the masks use URL in their styles.
> My commit just arose an previous existing problem. See bug 94765
> 
> *** This bug has been marked as a duplicate of bug 94765 ***

Not a duplicate of bug 94765
Comment 11 Xisco Faulí 2019-09-19 08:37:38 UTC
*** Bug 127376 has been marked as a duplicate of this bug. ***
Comment 12 Xisco Faulí 2019-09-20 14:17:35 UTC
Created attachment 154323 [details]
min document
Comment 13 Xisco Faulí 2019-09-20 15:23:49 UTC
I believe the problem is

<use id="use6320" xlink:href="#surface7672">

pointing to <g id="surface7672"> with a child <path id="path1132"> defining the style.
If the path style is defined in <g id="surface7672"> or <use id="use6320" xlink:href="#path1132"> the style is applied
Comment 14 Xisco Faulí 2019-09-20 15:55:58 UTC
Created attachment 154329 [details]
How the image looks like before my patch
Comment 15 QA Administrators 2021-09-20 03:42:13 UTC Comment hidden (obsolete)
Comment 16 Xisco Faulí 2021-12-02 16:52:56 UTC
Created attachment 176656 [details]
LibreOffice 7.3 vs Firefox vs Chrome

Interestingly, LibreOffice draws the image the same way as Firefox
Comment 17 Xisco Faulí 2021-12-02 18:12:00 UTC
*** Bug 146009 has been marked as a duplicate of this bug. ***
Comment 18 Xisco Faulí 2021-12-03 10:09:28 UTC
I checked this issue again but I couldn't find the reason why attachment 124712 [details] gets rendered as displayed in https://bug-attachments.documentfoundation.org/attachment.cgi?id=154329 if I revert my commit. Maybe i'll just revert it so at least bug 127376 and bug 146009 are fixed
Comment 19 Xisco Faulí 2023-07-06 12:57:11 UTC
The problem is in the mask calling a filter
Comment 20 Xisco Faulí 2023-07-06 12:59:01 UTC
Probably the same root cause as bug 136492
Comment 21 Xisco Faulí 2023-07-07 14:25:03 UTC
The problem with the sample file is that it applies an alpha matrix, which is not supported by LibreOffice at the moment. If values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0" is replaced by values="0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0", then it works.
Comment 22 Xisco Faulí 2023-07-07 14:27:20 UTC
*** Bug 136492 has been marked as a duplicate of this bug. ***
Comment 23 Xisco Faulí 2023-07-07 14:42:42 UTC
I know how to fix it
Comment 24 Commit Notification 2023-07-10 11:53:49 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/fa61e8b220aa1f34b022b9af485f0209b2cb25d1

tdf#99562: Do not ignore last column from matrix

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 25 Commit Notification 2023-07-10 12:44:57 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/a74e4ebdfc2e85bf4fec6e8ac7aa2980473e81f3

tdf#99562: Do not ignore last column from matrix

It will be available in 7.6.0.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.