Bug 149754 - Gradient visualization no longer capable to display areas outside DefinitionRange
Summary: Gradient visualization no longer capable to display areas outside DefinitionR...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Armin Le Grand
URL:
Whiteboard: target:7.5.0
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-28 09:13 UTC by Armin Le Grand
Modified: 2022-06-28 15:48 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Writer example with a gradient filled Frame & a anchored SubFrame that is not correctly filled (13.96 KB, application/vnd.oasis.opendocument.text)
2022-06-28 09:13 UTC, Armin Le Grand
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Armin Le Grand 2022-06-28 09:13:55 UTC
Created attachment 180991 [details]
Writer example with a gradient filled Frame & a anchored SubFrame that is not correctly filled

A Gradient has a DefinitionRange and a OutputRange, e.g when the whole page has a gradient that's it's DefinitionRange, objects placed on it may only use a part of it when being placed inside it, where then the OutputRange would be inside the DefinitionRange.
But there are also cases where the OutputRange is not completely inside the DefinitionRange. One such case are Frames in Writer with Frames anchored in Frames & parent Frame filled with Gradient, you may move child frame outside parent -> Parts outside parent/DefinitionRange stay empty/not painted. This is an error and worked once.
I add an example that shows the error as that example.
Since the new FillMode SlideBackgroundFill also uses that I stumbled over it & have to correct it.
Comment 1 Armin Le Grand 2022-06-28 09:14:34 UTC
Taking a look
Comment 2 Armin Le Grand 2022-06-28 09:16:42 UTC
Problem is in VclPixelProcessor2D::processFillGradientPrimitive2D:

VCL gradient draw is not capable to handle all primitive gradient definitions, what should be clear due to being developed to ectend/replace them in capabilities & precision.
It is e.g. not capable to correctly paint if the OutputRange is not completely inside the DefinitionRange, thus forcing to paint gradent parts *outside* the DefinitionRange.
This happens for Writer with Frames anchored in Frames (and was broken due to falling back to VCL Gradient paint here), and for the new SlideBackgroundFill Fill mode for objects using it that reach outside the page (which is the DefinitionRange in that case).
I see no real reason to fallback here to OutputDevice::DrawGradient and VCL gradient paint at all (system-dependent renderers wouldn't in the future), but will for convenience only add that needed additional correcting case...
Comment 3 Armin Le Grand 2022-06-28 09:18:49 UTC
Note: Also needed to correct/complete tdf#128150
Comment 4 Armin Le Grand 2022-06-28 15:48:41 UTC
doe with https://gerrit.libreoffice.org/c/core/+/136561
Comment 5 Commit Notification 2022-06-28 15:48:46 UTC
Armin Le Grand (allotropia) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0be0b4e57cbeaab3e73f1d12ef2ad9b55fd1c885

tdf#149754 correct gradient paint for outside definition range

It will be available in 7.5.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.