[Libreoffice-bugs] [Bug 130150] New: Broken clipping in PDF export

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Jan 23 19:20:35 UTC 2020


https://bugs.documentfoundation.org/show_bug.cgi?id=130150

            Bug ID: 130150
           Summary: Broken clipping in PDF export
           Product: LibreOffice
           Version: 5.3.5.2 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: graphics stack
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: glogow at fbihome.de

Created attachment 157375
  --> https://bugs.documentfoundation.org/attachment.cgi?id=157375&action=edit
Broken clipping in non-form PDF export shows Markierfeld titles

When converting the attached ODT to PDF, for example via command line like:

soffice --convert-to pdf --outdir . broken_pdf_clipping.odt

or in Writer using PDF export *without* selecting "create PDF form", the
resulting PDF document looses the clipping of the existing checkbox titles.

Reverting the patch from bug 99680 fixes this problem.

The history of the problem is something like:

- commit 581806182ac7 ("tdf#99680 modified clipping for PDF export")
- commit 86b47f5138c0 ("tdf#44388: handle the NULL clip correctly for pdf
output")
- commit a334752d091f ("vcl109: #i65128# avoid breaking polygonal clip regions
into rectangles in PDF export").

The latest patch changed the semantics of the clip region parameters:
- m_bClipRegion = true
- m_aClipRegion.count() == 0

from "// NULL clip, i.e. nothing visible" to "no clipping applied".

This inherently conflicts with the code of PDFWriterImpl::intersectClipRegion,
which "intersects clip regions". When intersecting clip regions / polygons, the
result might be an empty intersection, but that doesn't mean, no clipping, but
nothing visible.

In the attached bug document that's the clip of the check box inside the clip
of the table.

Obviously the revert results in bug 99680 again. Inspecting that original bug
shows rounding problems with the simple test document attached to that bug
(attachment 133268), resulting in an empty clip region for the first stack
object from calling basegfx::utils::solvePolygonOperationAnd in
PDFWriterImpl::intersectClipRegion.

And in the end it's also the origin of bug 113449, which is also about rounding
problems in intersectClipRegion, but in an other place in the call stack. Both
bugs AFAIK fail in stripDispensablePolygons. This one in B2DRange::isInside,
the other one in basegfx::utils::isInside, used to detect the case of polygons
inside each other. Since these fail, no intersection is detected and the result
is empty, or - with tdf#99680 applied - completely unclipped / visible.

Bug 113449 claims "there is no problem with the commit [581806182ac7]", but
from my analysis, the patch is wrong, or I misunderstood that analysis.

Still I currently also have no good idea where to fix it and do the rounding to
fix the comparison. This is some subtle rounding problem in the basegfx based
stack. And it's definitely no easy hack from the analysis point of view, even
when a real fix might be as simple as a single round or an adapted comparison.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20200123/5961a3f3/attachment-0001.htm>


More information about the Libreoffice-bugs mailing list