Bug 91254 - EMF+ corruption on Linux
Summary: EMF+ corruption on Linux
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
4.3 Daily
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.0.0
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-13 08:41 UTC by Andras Timar
Modified: 2015-05-22 14:43 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Anonymized bugdoc (EMF+) (42.78 KB, application/emf)
2015-05-13 08:41 UTC, Andras Timar
Details
Reference rendering in Word 2010 (74.58 KB, image/png)
2015-05-13 08:42 UTC, Andras Timar
Details
LibreOffice in Windows -- OK (70.91 KB, image/png)
2015-05-13 08:43 UTC, Andras Timar
Details
LibreOffice in Linux -- lines missing (106.09 KB, image/png)
2015-05-13 08:43 UTC, Andras Timar
Details
LibreOffice in OS X -- all but text are missing (127.10 KB, image/png)
2015-05-13 08:44 UTC, Andras Timar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andras Timar 2015-05-13 08:41:57 UTC
Created attachment 115547 [details]
Anonymized bugdoc (EMF+)

The attached EMF+ image is not opened correctly on Linux, lines are not shown (e.g. arrow lines).

* The bug was originally found on Linux (64-bit).
* The bug is not reproduced on Windows (both 32-bit and 64-bit). 
* The chart looks terribly broken with OS X builds. Only text elements are displayed.
* On all platforms rendering is OK with EMF_PLUS_DISABLE=1, not perfect of course, because the EMF+ image has more details. 
* I bisected the problem on Linux, and the first bad commit was mine, but in my opinion it only triggered the bug, because it seems to be unrelated.

 5b8ad54cc596a58da1f79937cc6709ce0799ac7f is the first bad commit
commit 5b8ad54cc596a58da1f79937cc6709ce0799ac7f
Author: Andras Timar <andras.timar@collabora.com>
Date:   Mon Jan 6 19:23:01 2014 +0100

    EMF/WMF: parse line cap and line join

I was surprised, that the following patch fixed the bug on Linux (but not on OS X):

diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index c314ef6..152bee6 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -936,7 +936,7 @@ bool EnhWMFReader::ReadEnhWMF()
                         switch( nStyle & 0xF00 )
                         {
                             case PS_ENDCAP_ROUND :
-                                aLineInfo.SetLineCap( com::sun::star::drawing::LineCap_ROUND );
+                                aLineInfo.SetLineCap( com::sun::star::drawing::LineCap_BUTT );
                             break;
                             case PS_ENDCAP_SQUARE :
                                 aLineInfo.SetLineCap( com::sun::star::drawing::LineCap_SQUARE );
Comment 1 Andras Timar 2015-05-13 08:42:33 UTC
Created attachment 115548 [details]
Reference rendering in Word 2010
Comment 2 Andras Timar 2015-05-13 08:43:11 UTC
Created attachment 115549 [details]
LibreOffice in Windows -- OK
Comment 3 Andras Timar 2015-05-13 08:43:50 UTC
Created attachment 115550 [details]
LibreOffice in Linux -- lines missing
Comment 4 Andras Timar 2015-05-13 08:44:49 UTC
Created attachment 115551 [details]
LibreOffice in OS X -- all but text are missing
Comment 5 Commit Notification 2015-05-15 14:35:26 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=aead21f7528047fe5c31c39ac6bec14b55f80293

tdf#91254: draw missing EMF hairlines with linecap settings

It will be available in 5.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 6 Andras Timar 2015-05-18 08:21:26 UTC
The commit above fixed the Linux case. Let's close this bug, I'll open a new one for OS X. That is a different bug.
Comment 7 Zangune 2015-05-22 14:43:19 UTC
Andras Timar, if you downloaded the LibreOffice daily build, tested it and you can confirm that this bug is fixed in the daily build then you can change the status from RESOLVED to VERIFIED in Bugzilla, this would be helpful.
Read here https://bugs.documentfoundation.org/show_bug.cgi?id=50100