Bug 156808 - FILEOPEN PPTX: soft edge effect makes image (except for soft edge) disappear
Summary: FILEOPEN PPTX: soft edge effect makes image (except for soft edge) disappear
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Patrick (volunteer)
URL:
Whiteboard: target:24.2.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2023-08-18 11:06 UTC by Gerald Pfeifer
Modified: 2023-11-17 06:20 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot showing the problem (241.63 KB, image/png)
2023-08-18 11:06 UTC, Gerald Pfeifer
Details
Sample image with softedge in Impress document (265.35 KB, application/vnd.oasis.opendocument.presentation)
2023-09-12 13:43 UTC, Patrick (volunteer)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gerald Pfeifer 2023-08-18 11:06:56 UTC
Created attachment 189025 [details]
Screenshot showing the problem

Using attachment #180067 [details] from bug #149042 it apperas the soft edge 
effect is quite broken (though surprisingly I cannot find anything
in Bugzilla).

Notice how in the screenshot
 - the slide pane shows the full image (a castle) for the first slide,
 - whereas the edit window only shows a bit of the edge and misses most
   of the image (which is wrong).

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 5fecd865303b3f0a2eeb0b9466d2bcf23cfce068
CPU threads: 8; OS: Linux 6.4; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Comment 1 Gerald Pfeifer 2023-08-18 11:09:43 UTC
If I reduce the radius of the soft edge from 6 down to 1, the visible
edge becomes smaller (and the white void instead of the image larger).

Moving to a radius of 0, i.e., no soft edge effect, then shows the 
entire image.


The issue shows in both edit and presentation modes.
Comment 2 Gabor Kelemen (allotropia) 2023-08-21 21:09:11 UTC
Started to be like this in 24.2 with:

https://git.libreoffice.org/core/+/e06456180ade61aa519819702810a3b9779a6e9e

author	Caolán McNamara <caolan.mcnamara@collabora.com>	Thu Jul 27 10:30:35 2023 +0100
committer	Caolán McNamara <caolan.mcnamara@collabora.com>	Thu Jul 27 15:13:06 2023 +0200

crashtesting: crash on export of forum-en-41439.odp to pdf

But just before this, opening the file crashed after the document content flashed up for 0.3 seconds, so this is already an improvement.

Commit that broke it is: 

commit 81994cb2b8b32453a92bcb011830fcb884f22ff3
Date:   Fri Apr 16 20:33:10 2021 +0200

    Convert internal vcl bitmap formats transparency->alpha (II)

Adding CC to: Noel Grandin
Comment 3 Commit Notification 2023-08-28 16:15:56 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

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

tdf#156808 soft edge effect makes image (except for soft edge) disappear

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 4 Gerald Pfeifer 2023-08-29 13:00:18 UTC
Happy to confirm as fixed; thank you!

  Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
  Build ID: 16d43b7c5396d6382926d514dc9ce10b3ce94cba
  CPU threads: 8; OS: Linux 6.4; UI render: default; VCL: gtk3
  Locale: en-US (en_US.UTF-8); UI: en-US


Is it possible to create a testcase? Xisco?

I'm worried something as fundamental apparently was not caught by
our regression testsuite.
Comment 5 Patrick (volunteer) 2023-09-12 13:43:17 UTC
Created attachment 189519 [details]
Sample image with softedge in Impress document
Comment 6 Patrick (volunteer) 2023-09-12 13:47:17 UTC
(In reply to Patrick Luby from comment #5)
> Created attachment 189519 [details]
> Sample image with softedge in Impress document

Reopening as there are no blurring of the edges in the above Impress document when running in a slideshow, printing, or exporting to PDF.

I suspect that there are separate drawing paths for the blurring the edges in such cases.
Comment 7 Patrick (volunteer) 2023-09-12 14:42:40 UTC
(In reply to Patrick Luby from comment #6)
> Reopening as there are no blurring of the edges in the above Impress
> document when running in a slideshow, printing, or exporting to PDF.
> 

Update: edges are blurred properly with Skia/Metal on macOS. The failure to blur the edges only occurs with Skia/Raster and Skia disabled.
Comment 8 Patrick (volunteer) 2023-09-12 19:32:51 UTC
(In reply to Patrick Luby from comment #7)
> Update: edges are blurred properly with Skia/Metal on macOS. The failure to
> blur the edges only occurs with Skia/Raster and Skia disabled.

After some debugging, I am seeing the break get executed (i.e. the alpha mask is empty) at drawinglayer/source/primitive2d/softedgeprimitive2d.cxx:198 when blurring the edges fails:

  // Get the Alpha and use as base to blur and apply the effect
  AlphaMask aMask(aBitmapEx.GetAlphaMask());
  if (aMask.IsEmpty()) // There is no mask, fully opaque
      break;

So, my current theory is that after the transparency->alpha patch, we now need to do some special handling when there is an empty alpha mask.

I will post another update when I have more news.
Comment 9 Commit Notification 2023-09-13 23:52:37 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4942aa1533af25cf102da7516bd5e521c553aa07

tdf#156808 force an alpha mask to be created even if it has no alpha

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 Patrick (volunteer) 2023-09-14 00:00:30 UTC
I think that I have fixed the failed blurring of edges when running a slideshow, printing, and exporting as PDF.

My fix should be in tomorrow's (14 September 2023) nightly master build.
Comment 11 Commit Notification 2023-10-11 09:39:38 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/40641b868b20c73e694770c2c7ea71e232514fa1

tdf#156808: 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 12 Gerald Pfeifer 2023-10-13 09:27:22 UTC
Tested originally, alas without formally verifying. Verified with

  Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
  Build ID: e9374f74385d7dfe77d1902d3d82af20143bc775
  CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
  Locale: en-US (en_US.UTF-8); UI: en-US

Thank you, Patrick!