Bug 145157 - Soft Edges effect distorting entire image in Impress
Summary: Soft Edges effect distorting entire image in Impress
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
7.2.1.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Impress-Images
  Show dependency treegraph
 
Reported: 2021-10-15 17:51 UTC by Rafael Lima
Modified: 2023-09-12 20:07 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
ODP Sample File (1.58 MB, application/vnd.oasis.opendocument.presentation)
2021-10-15 17:51 UTC, Rafael Lima
Details
PDF Sample File (417.98 KB, application/pdf)
2021-10-15 17:51 UTC, Rafael Lima
Details
ODP Sample File - Ex 2 (1.06 MB, application/vnd.oasis.opendocument.presentation)
2021-10-17 21:43 UTC, Rafael Lima
Details
PDF Sample File - Ex 2 (543.71 KB, application/pdf)
2021-10-17 21:44 UTC, Rafael Lima
Details
Screenshot: left part with soft edge, right part without (233.94 KB, image/png)
2021-10-17 22:47 UTC, Regina Henschel
Details
Screenshot (left side has Soft Edges effect) (1.51 MB, image/png)
2021-10-17 23:21 UTC, Rafael Lima
Details
Video capture showing the bug (2.59 MB, video/mp4)
2021-11-15 22:13 UTC, Rafael Lima
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Lima 2021-10-15 17:51:06 UTC
Created attachment 175765 [details]
ODP Sample File

In Impress, applying the Soft Edges effect distorts the entire image instead of only softening the edges (while keeping the rest of the image intact).

Distortion can be noted during presentation as well as while editing the slides. However, the exported PDF does not seem to have the problem.

I created two test files:
1) The "ODP Sample File" has two slides. In each of them I used the same image twice (the first without the effect and the second with the effect). In presentation mode, notice in the highlighted parts that the image is actually a bit distorted.

2) The "PDF Sample File" is the PDF exported from the ODP file. In the PDF file I do not see any distortion... so this might have something to do with rendering.

System info:
Version: 7.2.2.2 / LibreOffice Community
Build ID: 20(Build:2)
CPU threads: 16; OS: Linux 5.11; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Ubuntu package version: 1:7.2.2~rc2-0ubuntu0.21.04.1~lo1
Calc: threaded
Comment 1 Rafael Lima 2021-10-15 17:51:37 UTC
Created attachment 175766 [details]
PDF Sample File
Comment 2 Rafael Lima 2021-10-15 17:56:26 UTC
BTW, when exporting as PDF the quality of the images is significantly worsened and pixelated (both with and without the soft edges effect). So I guess the PDF part of my original report has nothing to do with Soft Edges, but rather with general poor image quality export.
Comment 3 Regina Henschel 2021-10-16 09:23:06 UTC
I have tested it in Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: a3416ed058884a1fcaae0659ff6e71f5a7dff8d0
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: de-DE (en_US); UI: en-US
Calc: threaded

I have tested too without Skia.

I see no problems, neither in show mode nor in pdf. Can you please be more specific about "distortion".
Comment 4 Roman Kuznetsov 2021-10-16 21:10:16 UTC
Please add a simpler example, I don't see the problem in your files anyway
Comment 5 Rafael Lima 2021-10-17 21:43:26 UTC
Created attachment 175798 [details]
ODP Sample File - Ex 2

I created another example that better illustrates the distortion I am seeing and uploaded it both as ODP and PDF.

This time around I used a polygon-based image. In the first slide I added the original image without any effects. In the second slide I applied the Soft Edges effect.

The distortion can be seen both in edit and presentation modes.
Comment 6 Rafael Lima 2021-10-17 21:44:29 UTC
Created attachment 175799 [details]
PDF Sample File - Ex 2

Notice that the distortion also appears in the PDF file.
Comment 7 Rafael Lima 2021-10-17 21:49:28 UTC
In Slide 2 of the new sample files I wrote "Without Soft Edges Effects" but what I meant is "With Soft Edges Effects". So, the correct text is:

Slide 1: Without Effects
Slide 2: With Soft Edges Effects
Comment 8 Regina Henschel 2021-10-17 22:47:23 UTC
Created attachment 175800 [details]
Screenshot: left part with soft edge, right part without

I see no problem. With and without soft edge looks the same to me.

The screenshots are from Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 93115d2c54d645bcf2f80fde325e3ede39dee4d5
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: de-DE (en_US); UI: en-US
Calc: CL
Comment 9 Rafael Lima 2021-10-17 23:21:34 UTC
Created attachment 175801 [details]
Screenshot (left side has Soft Edges effect)

Hi Regina! Thanks for your help with this issue. Indeed in your screenshot there's no visible distortion.

So, I upload a screenshot of what I'm seeing. Note that the image in the right is more pixelated.

This test was done in KDE using LO 7.3 alpha, but I had the same results in Windows.

Can this be related to graphics card maybe? I use Nvidia in both my PCs.
Comment 10 Rafael Lima 2021-11-15 22:13:02 UTC
Created attachment 176275 [details]
Video capture showing the bug

This video capture shows how soft edge distorts the image. Notice that when I switch from radius 0 to 1 the image gets distorted. When I get back to 0 the image is restored.
Comment 11 Rafael Lima 2022-04-04 12:29:18 UTC
@Mike, what do you think of this issue while applying soft edges.

See video in Comment 9 for more details of how the effect is distorting the image.
Comment 12 Mike Kaganski 2022-04-04 12:33:22 UTC
(In reply to Rafael Lima from comment #11)
> @Mike, what do you think of this issue while applying soft edges.

I didn't check the code, but I (seem to) remember there was some pixel count limit, after which we limit the image quality to avoid freezing. This *might* be that.
Comment 13 Mike Kaganski 2022-07-21 14:26:38 UTC
I can see the problem with attachment 175798 [details] on Windows in presentation mode, using Version: 7.4.0.1 (x64) / LibreOffice Community
Build ID: 43e5fcfbbadd18fccee5a6f42ddd533e40151bcf
CPU threads: 12; OS: Windows 10.0 Build 19044; UI render: default; VCL: win
Locale: en-US (ru_RU); UI: en-US
Calc: CL

(and also using Skia rendering on the same system).
With Skia, the resulting view is blurred; with default render and disabled AA / HW acceleration, the view is pixelated.

Indeed, as I suspected, we do have a code to down-sample bitmaps: VclMetafileProcessor2D::CreateBufferDevice [1] that checks that the image for effect processing has no greater than 500 000 pixels (which is around 707x707 pixel bitmap). But unexpectedly, this downsampling didn't trigger in this case! The bitmap size is calculated from the passed logical object range, which is 14730x15750 units. These units are converted to pixels using OutputDevice::LogicToPixel, and the result is 557x596 pixels.

This value is independent on the screen resolution; it seems that VclMetafileProcessor2D uses the object's logical size (which is, for the image with effect, 14.73x15.75 cm = 14730x15750 mm/100 units that are used internally). It is converted using a default 96 PPI resolution, and then that image size is used for effects and rendered back to the metafile, which will be rendered to screen when this slide's turn arrives. Given that e.g. my screen is 1920x1080 pixels, and the image takes almost full height, the bitmap used for the rendering is about two times shorter than needed for a reasonable quality.

The question is: how can I get the target resolution at which the metafile is going to be displayed. If I get that, then it could make sense to increase the maximum bitmap size here.

OTOH, I couldn't get the problem in edit mode on Windows. This codepath doesn't use VclMetafileProcessor2D, so no downsampling takes place. Could it be that kf5 uses a different rendering codepath, or maybe there's some other way to enable metafile rendering in editing mode?

Thorsten, Armin: sorry to bother you, but maybe you have some ideas how to handle this?


[1] https://opengrok.libreoffice.org/xref/core/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx?r=a447b5b6#2374
Comment 14 Rafael Lima 2023-09-12 20:07:29 UTC
This issue is still reproducible in

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: d52feb11c7eab0adf82c1fb410adfd3127bf9497
CPU threads: 12; OS: Linux 6.2; UI render: default; VCL: kf5 (cairo+wayland)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Calc: CL threaded

@Noel, maybe you would like to take a look at this one?