Bug 113449 - numerical inconsistency in basegfx::utils::isInside() causes wrong clipping in PDF export
Summary: numerical inconsistency in basegfx::utils::isInside() causes wrong clipping i...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:pdf
Depends on:
Blocks: PDF-Export
  Show dependency treegraph
 
Reported: 2017-10-25 16:33 UTC by Michael Stahl (allotropia)
Modified: 2022-01-23 03:42 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
unit test for the failing call (1.10 KB, text/plain)
2017-10-25 16:36 UTC, Michael Stahl (allotropia)
Details
ridiculous hack that makes this document happy (729 bytes, text/plain)
2017-10-25 16:37 UTC, Michael Stahl (allotropia)
Details
minimised bugdoc for PDF export (21.76 KB, application/vnd.oasis.opendocument.presentation)
2017-10-25 16:39 UTC, Michael Stahl (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Stahl (allotropia) 2017-10-25 16:33:42 UTC
exporting the LO conference 2017 template to PDF results in wrong clipping on the Agenda page: there should be a vertical clip of the green group shape on the left, but the actual result is an un-clipped shape that extends into the text box as a triangle.

the PDF should contain this on the 2nd shape exported from drawPolyPolygon:
 0 0 307.5 595.2 re
 +W* n

but it's missing because the m_aClipRegion is empty at that point, because intersectClipRegion of these PolyPolygons results in [0:], i.e. empty:

%  XXX aOld [1:<4:(0,0)--(3075.02,0)--(3075.02,5952.76)--(0,5952.76)>]
%  XXX aRegion [1:<4:(-1276.72,-62.0787)--(3075.02,-62.0787)--(3075.02,6108.38)--(-1276.72,6108.38)>]

this is because of an inconsistency in basegfx::utils::isInside()
where isPointOnPolygon returns false (so it's not on the edge)
but then bCompXA is also false (because it's detected as equal to the edge),
so the isInside() wrongly returns false.

the problem is caused by a tiny difference in X,
3075.0236220472434 vs 3075.0236220472439

involved objects:

(rr) p *rCandidate.mpPolygon.m_pimpl
$33 = {
  m_value = {
    maPoints = {
      maVector = std::__debug::vector of length 4, capacity 4 = {{
          <basegfx::B2DPoint> = {
            <basegfx::B2DTuple> = {
              mfX = -1276.724409448819,
              mfY = -62.078740157480311
            }, <No data fields>}, <No data fields>}, {
          <basegfx::B2DPoint> = {
            <basegfx::B2DTuple> = {
              mfX = 3075.0236220472439,
              mfY = -62.078740157480311
            }, <No data fields>}, <No data fields>}, {
          <basegfx::B2DPoint> = {
            <basegfx::B2DTuple> = {
              mfX = 3075.0236220472439,
              mfY = 6108.3779527559054
            }, <No data fields>}, <No data fields>}, {
          <basegfx::B2DPoint> = {
            <basegfx::B2DTuple> = {
              mfX = -1276.724409448819,
              mfY = 6108.3779527559054
            }, <No data fields>}, <No data fields>}}
    },
    mpControlVector = std::unique_ptr<ControlVectorArray2D> containing 0x0,
    mpBufferedData = std::unique_ptr<ImplBufferedData> containing 0x7eee920,
    mbIsClosed = true
  }, 
  m_ref_count = 5
}

(rr) p aCurrentPoint
$40 = {
  <basegfx::B2DTuple> = {
    mfX = 3075.0236220472439,
    mfY = 6108.3779527559054
  }, <No data fields>}
(rr) p aPreviousPoint
$41 = {
  <basegfx::B2DTuple> = {
    mfX = 3075.0236220472439,
    mfY = -62.078740157480311
  }, <No data fields>}

(rr) p rPoint
$34 = (const basegfx::B2DPoint &) @0x7ffcc8ab2af0: {
  <basegfx::B2DTuple> = {
    mfX = 3075.0236220472434,
    mfY = 0
  }, <No data fields>}



the PDF export changed with commit 581806182ac7da81115c9675b4e828688178aa04
but it was differently wrong before that commit, the particular shape in the group shape was missing completely, and there is no problem with the commit.
Comment 1 Michael Stahl (allotropia) 2017-10-25 16:36:21 UTC
Created attachment 137290 [details]
unit test for the failing call

unit test to demonstrate the one call that causes all the trouble, run with
make CppunitTest_basegfx CPPUNIT_TEST_NAME="KeyStopLerpTest::testIsInside"
Comment 2 Michael Stahl (allotropia) 2017-10-25 16:37:28 UTC
Created attachment 137291 [details]
ridiculous hack that makes this document happy
Comment 3 Michael Stahl (allotropia) 2017-10-25 16:39:25 UTC
Created attachment 137292 [details]
minimised bugdoc for PDF export
Comment 4 Michael Stahl (allotropia) 2017-10-25 16:40:30 UTC
forgot to mention: i tried OOo 3.3 and the PDF export had the same issue.
Comment 5 QA Administrators 2018-10-27 02:54:56 UTC Comment hidden (obsolete)
Comment 6 Roman Kuznetsov 2019-03-16 20:36:38 UTC
Michael, are there any news about this bug?
Comment 7 Michael Stahl (allotropia) 2019-03-18 12:26:52 UTC
bug still happens on current master
Comment 8 Xisco Faulí 2019-03-18 20:04:57 UTC
(In reply to Michael Stahl (CIB) from comment #7)
> bug still happens on current master

Hi Michael,
Do you think we could turn this issue into an easyhack ?
Comment 9 QA Administrators 2022-01-23 03:42:29 UTC
Dear Michael Stahl (CIB),

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug