Bug 157635

Summary: FILEOPEN: image transparent in PPTX
Product: LibreOffice Reporter: Xisco Faulí <xiscofauli>
Component: ImpressAssignee: Patrick Luby (volunteer) <guibomacdev>
Status: RESOLVED FIXED    
Severity: normal CC: guibomacdev, noelgrandin, stephane.guillou, xiscofauli
Priority: medium Keywords: bibisected, bisected, regression
Version: 24.2.0.0 alpha0+   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=156630
https://bugs.documentfoundation.org/show_bug.cgi?id=157793
Whiteboard: target:24.2.0
Crash report or crash signature: Regression By: Patrick Luby
Bug Depends on:    
Bug Blocks: 108437    
Attachments: Comparsion MSO vs LibreOffice 24.2 master

Description Xisco Faulí 2023-10-06 11:40:06 UTC
Created attachment 190061 [details]
Comparsion MSO vs LibreOffice 24.2 master

Steps to reproduce:
1. Open attachment 60733 [details] from bug 49253

-> First slide doesn't have a background. See comparison

Reproduced in

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 0c4913e03e8427a576138601958f2dbf13b8c37b
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: es-ES (es_ES.UTF-8); UI: en-US
Calc: threaded

[Bug found by office-interoperability-tools]
Comment 1 Xisco Faulí 2023-10-06 11:40:34 UTC Comment hidden (obsolete)
Comment 2 Xisco Faulí 2023-10-06 11:41:11 UTC
Regression  introduced by:

author	Patrick Luby <plubius@neooffice.org>	2023-08-07 12:17:36 -0400
committer	Patrick Luby <plubius@neooffice.org>	2023-08-10 14:01:10 +0200
commit 12fd870113a663dde5ceb38c61f1986a34095d0e (patch)
tree 04982fbf6a4ed1de1fda1346e73385b375e76e52
parent 0d8a5f89bff51480d721395729a67e7b4260aea5 (diff)
tdf#156630 eliminate opaque parts when drawing animated PNG images

Bisected with: bibisect-linux64-24.2$

Adding Cc: to Patrick Luby
Comment 3 Stéphane Guillou (stragu) 2023-10-06 12:47:37 UTC
Confirmed.
It's image "Рисунок 1" that is completely transparent.
Comment 4 Patrick Luby (volunteer) 2023-10-06 16:10:02 UTC
Note to myself: adding an AlphaMask::Invert() in the following debug patch fixes rendering of the first slide's background in the document, slideshow, printing, and export to PDF.

Unfortunately, it also causes https://bugs.documentfoundation.org/show_bug.cgi?id=156630 to reappear so I will have to see if I can find a place to invert the alpha mask before it reaches this code:


diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index e5658f6cf0d3..492179f803b4 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -180,7 +180,8 @@ namespace drawinglayer::primitive2d
                 BitmapEx bitmap;
                 if( useAlphaMask )
                 {
-                    const AlphaMask aMaskBitmap(maVirtualDeviceMask->GetBitmap(Point(), maVirtualDeviceMask->GetOutputSizePixel()));
+                    AlphaMask aMaskBitmap(maVirtualDeviceMask->GetBitmap(Point(), maVirtualDeviceMask->GetOutputSizePixel()));
+                    aMaskBitmap.Invert(); // convert from transparency to alpha
                     bitmap = BitmapEx(aMainBitmap, aMaskBitmap);
                 }
                 else
Comment 5 Xisco Faulí 2023-10-06 18:25:19 UTC
@Patrick, the original report ( bug 49253 ) was about the same problem and it was fixed with https://cgit.freedesktop.org/libreoffice/core/commit/?id=b184a8734f0abd7fd2b1d450a4119ecbaca41589, maybe it can give you a hint ?
Comment 6 Patrick Luby (volunteer) 2023-10-06 19:59:58 UTC
(In reply to Xisco Faulí from comment #5)
> @Patrick, the original report ( bug 49253 ) was about the same problem and
> it was fixed with
> https://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=b184a8734f0abd7fd2b1d450a4119ecbaca41589, maybe it can give you a hint ?

Thank you for the link. I tried flipping the fill color in that patch to COL_WHITE (i.e. opaque) but while that fixed this bug, that causes https://bugs.documentfoundation.org/show_bug.cgi?id=156630 to reappear.

Fortunately, I think that I have found a different place in the code (i.e. the .gif loading code) to mask out the missing image in the following patch. The patch also appears to fix https://bugs.documentfoundation.org/show_bug.cgi?id=157576:

https://gerrit.libreoffice.org/c/core/+/157665
Comment 7 Commit Notification 2023-10-06 20:31:47 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b2ca39bc5e424e67e8fc7e8a044214feb09e39f7

tdf#157576 and tdf#157635 mask out black pixels

It will be available in 24.2.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 8 Patrick Luby (volunteer) 2023-10-06 20:44:02 UTC
I have committed a fix for the missing background image. It should be included in tomorrow's (07 October 2023) nightly master build.
Comment 9 Commit Notification 2023-10-09 12:03:28 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4e1aec7937c0ccd9aa3c5c34091e94786f16e145

tdf#49253, tdf#157635, tdf#157576: sd_png_export: Add unittest

It will be available in 24.2.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 10 Commit Notification 2023-10-20 12:41:37 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a98000c028a3c68329fdb2047f51f8d271b2290c

tdf#157793 limit tdf#157635 fix to only larger palettes

It will be available in 24.2.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 11 Commit Notification 2023-11-03 17:33:02 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2a5dac6d75b346a77652dec05cafa6562177d40f

tdf#158047 allow the tdf#157635 fix for palettes with 64 entries

It will be available in 24.2.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.