Bug 133716

Summary: Unecessary Gradient in The Box Border of Presenter Console
Product: LibreOffice Reporter: Rizal Muttaqin <rizmut>
Component: UIAssignee: dldld <daniel-loh>
Status: VERIFIED FIXED    
Severity: normal CC: aron.budea, daniel-loh, quikee
Priority: medium Keywords: bibisected, bisected, regression
Version: 6.1.0.3 release   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=117826
Whiteboard: target:7.4.0
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 116280, 124438    
Attachments: Disturbing extra gradients
Right is how it look when started working -> Left shows setting the alpha channel on rendering the border images to not transparent -> not related to alpha channel handling
Pixel image to scale 20x20 pixels
Scaled pixel image also has broder issues
Scaled pixel image with applied fix
Presenter Console with applied fix

Description Rizal Muttaqin 2020-06-06 03:29:02 UTC
Created attachment 161672 [details]
Disturbing extra gradients

Step to reproduce

1. Open a Impress file or create a new one 
2. Use second monitor to activate Presenter Console. Otherwise, use Open Expert Configuration via Tools > Options > LibreOffice > Advanced. Search for StartAlways. We should get a node org.openoffice.Office.PresenterScreen with line Presenter. Double-click that line to toggle the boolean value to true. Click OK > OK
3. Look at the attached screenshot, there are extra gradients in every corner of the box that disturbing. This happens with kf5 and gtk3 backend. But not in gen.



Versi: 6.4.3.2
ID Build: 1:6.4.3-0ubuntu0.18.04.1
Thread CPU: 4; OS: Linux 4.20; Render UI: baku; VCL: kf5; 
Locale: id-ID (id_ID.UTF-8); Bahasa-UI: id-ID
Calc: threaded

Version: 7.1.0.0.alpha0+
Build ID: 6096d67aa67b0eb3da5e9ad9ae1eaa04baa5102c
CPU threads: 4; OS: Linux 4.20; UI render: default; VCL: kf5
Locale: id-ID (id_ID.UTF-8); UI: en-US
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2020-06-04_05:27:02
Calc: threaded
Comment 1 Aron Budea 2020-06-09 07:39:14 UTC
Confirmed in LO 6.4.4.2 & 6.2.0.3 & latest of bibisect-linux-64-6.1.
Looks fine in 6.1.0.3 & latest of bibisect-linux-64-6.0.
=> regression
Comment 2 Aron Budea 2020-06-09 18:30:10 UTC
Bibisected to the following commit using repo bibisect-linux-64-6.1 (so it must be there in 6.1.0.3, I probably made a mistake). Same commit as for bug 117826.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=ea3d755ac949c1b6dada5c341e018f8c23f5d395
author		Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>	2018-03-31 17:27:01 +0900
committer	Tomaž Vajngerl <quikee@gmail.com>	2018-04-10 08:33:55 +0200

vcl: detach usage and remove GraphicManager and GraphicCache
Comment 3 dldld 2022-05-08 20:46:28 UTC
Started working on this bug.

It seems to be related to the fact that the cairo rendering is not using CAIRO_FILTER_NEAREST to scale the border images correctly.

https://cgit.freedesktop.org/libreoffice/core/tree/vcl/headless/SvpGraphicsBackend.cxx#n679

Removing the following condition seems to fix the issue. 
if ((fXScale != 1.0 && rTR.mnSrcWidth == 1) || (fYScale != 1.0 && rTR.mnSrcHeight == 1))


Background, is that the border pictures, which are getting scaled are having a size of 26x26 pixels, so that the condition is not met and the cairo rendering is using a "smooth" interpolation instead of hard cuts.
Comment 4 dldld 2022-05-08 20:49:58 UTC
Created attachment 180006 [details]
Right is how it look when started working -> Left shows setting the alpha channel on rendering the border images to not transparent -> not related to alpha channel handling
Comment 5 dldld 2022-05-13 20:21:46 UTC
Created attachment 180106 [details]
Pixel image to scale 20x20 pixels
Comment 6 dldld 2022-05-13 20:27:03 UTC
Created attachment 180107 [details]
Scaled pixel image also has broder issues

This issue with scaling an image is not only related to the PresenterConsole. It also happens, when adding a picture to a presentation and scaling it up. The borders should be black as shown in the image "Pixel image to scale 20x20 pixels" but in reality it has a weird gradient to gray.
Comment 7 dldld 2022-05-14 16:02:50 UTC
Created attachment 180118 [details]
Scaled pixel image with applied fix

Scaled pixel image with applied fix from patch: 
https://gerrit.libreoffice.org/c/core/+/134325
Comment 8 dldld 2022-05-14 16:03:40 UTC
Created attachment 180119 [details]
Presenter Console with applied fix

Presenter Console with applied fix from patch:
https://gerrit.libreoffice.org/c/core/+/134325
Comment 9 Commit Notification 2022-05-14 18:01:54 UTC
dldld committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/20f0ab23b1c0b60ca36a053464f3ba41bf27c80e

tdf#133716: Fix edge gradient when upscaling image

It will be available in 7.4.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 Rizal Muttaqin 2022-05-16 00:09:27 UTC
Thanks dldld. Your work is awesome!!!

VERIFIED FIXED in 
Version: 7.4.0.0.alpha1+ / LibreOffice Community
Build ID: 163e4686914ecf04f1cbef2f6a087cadbfe59f81
CPU threads: 8; OS: Linux 5.13; UI render: default; VCL: kf5 (cairo+xcb)
Locale: id-ID (id_ID.UTF-8); UI: id-ID
Calc: threaded
Comment 11 Rizal Muttaqin 2022-05-16 02:24:29 UTC
Using gtk3 backend, the issue is fixed also

Version: 7.4.0.0.alpha1+ / LibreOffice Community
Build ID: 163e4686914ecf04f1cbef2f6a087cadbfe59f81
CPU threads: 8; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded