Bug 100451

Summary: 4-bit image in WMF inserted into document is mishandled in PDF export when OpenGL is used
Product: LibreOffice Reporter: How can I remove my account? <tml>
Component: graphics stackAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: h3734236, quikee, tml
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard: target:5.3.0 target:5.2.0.1 target:5.1.5
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 93529    

Description How can I remove my account? 2016-06-17 11:27:42 UTC
If you insert a WMF that includes a 4-bit image into a Writer document, and export it as PDF while OpenGL is being used, the image looks very wrong in the resulting PDF. The colours are inverted (at least in the sample case I am looking at) and additionally there is some randomise looking noise in the background.

Unfortunately the sample WMF can not be made publicly available without asking the customer for permission. Will do.
Comment 1 How can I remove my account? 2016-06-17 11:35:05 UTC
Ideally I would love to see all internal use of anything except 1bpp (black&white) and 24bpp (full colour) images ("Bitmaps") in LibreOffice go away. There is really no need for palettized colour modes to survive in this century, I think. Such images should be turned into the corresponding 24bpp ones whenever read in, and all code inside LO to handle such formats back and forth could then be dropped. But that is just my opinion; of course it is possible that doing that would have a significant negative impact on performance or resource use in some pathological but not uncommon cases, or whatever.
Comment 2 How can I remove my account? 2016-06-17 15:51:57 UTC
Looking closer at the WMF, it first has one 1bpp image that is StretchBlt:ed with SRCPAINT, then a 4bpp one that is StretchBlted to the same place with SRCAND. I would assume that it is the 4bpp one that is mishandled, though.
Comment 3 Commit Notification 2016-06-21 06:54:16 UTC
Tomaž Vajngerl committed a patch related to this issue.
It has been pushed to "master":

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

tdf#100451 convert texture buffer to 1-bit and 4-bit palette buffer

It will be available in 5.3.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 4 Commit Notification 2016-06-21 11:04:39 UTC
Tomaž Vajngerl committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=60b74fe1775e647545d2da1fcc58a4c63ec18aa5&h=libreoffice-5-2

tdf#100451 convert texture buffer to 1-bit and 4-bit palette buffer

It will be available in 5.2.0.1.

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 5 Commit Notification 2016-06-23 09:44:17 UTC
Tomaž Vajngerl committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ebad0ff6da52d3f3bf9ca026ed2699df0673ce76&h=libreoffice-5-1

tdf#100451 convert texture buffer to 1-bit and 4-bit palette buffer

It will be available in 5.1.5.

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.