Bug 125782 - command Q (quadraticcurveto) uses wrong 'current point'
Summary: command Q (quadraticcurveto) uses wrong 'current point'
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Regina Henschel
URL:
Whiteboard: target:6.4.0 target:6.3.0.1
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-07 14:09 UTC by Regina Henschel
Modified: 2019-06-19 07:42 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
TearDrop shape with screenshot, how it looks in Word (29.62 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-06-07 14:09 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2019-06-07 14:09:26 UTC
Created attachment 152029 [details]
TearDrop shape with screenshot, how it looks in Word

The custom shapes are defined by the draw:enhanced-path attribute of the <draw:enhanced-geometry> element in ODF. This path uses commands like lineto and arcto. Some of the commands refer to "current point" as start of its segment. In the current implementation such "current point" is not tracked. That works as long as the coordinates of the "current point" are not needed for the command itself.

But the quadratic Bézier curve is implemented, so that the equivalent cubic Bézier  curve is used. And for getting the first control point the coordinates of the start point are needed.

The current implementation assumes, that the "current point" is the previous point in the point sequence. But that is wrong in case the previous command is one of the several 'arc' commands. For those commands the last coordinate pair represents an angle.

The error becomes visible in the "teardrop" shape. Is has a path with 'arcangleto' followed by 'quadraticcurveto'. See attachment.

I suggest to solve the problem by tracking the "current point" in EnhancedCustomShape2d::CreateSubPath(). That has the advantage, that not only command 'quadraticcurveto' can be implemented properly, but the command 'closepath' too.
Comment 1 Regina Henschel 2019-06-08 19:42:10 UTC
Let start with the obvious error in QuadraticCurveTo. (It is my fault. I had implemented it.) How to handle 'current point' in general, is a different problem and should go to a new report.
Comment 2 Commit Notification 2019-06-10 18:01:33 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/39599fc689364b70cf83e834a5742cc2181b13b0%5E%21

tdf#125782 use correct 'current point' for quadraticcurveto

It will be available in 6.4.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 3 Regina Henschel 2019-06-12 11:50:53 UTC
Fix is in Version: 6.4.0.0.alpha0+ (x64)
Build ID: 7aaa7212f2f37606b34d44a039398f05c02d5660
CPU threads: 8; OS: Windows 10.0; UI render: default; VCL: win; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2019-06-11_23:48:14
Locale: de-DE (en_US); UI-Language: en-US
Calc: threaded
Comment 4 Commit Notification 2019-06-19 07:42:13 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

https://git.libreoffice.org/core/+/54c7f48ded248f6da6a22fffca053d82674aa7b5%5E%21

tdf#125782 use correct 'current point' for quadraticcurveto

It will be available in 6.3.0.1.

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.