Bug 383943 - HiDPI: Rendering glitches near the page boundaries
Summary: HiDPI: Rendering glitches near the page boundaries
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 1.2.70
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-24 10:28 UTC by Oliver Sander
Modified: 2019-07-26 16:46 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.8.0
Sentry Crash Report:


Attachments
screenshot showing the problem (313.91 KB, image/png)
2017-08-24 10:28 UTC, Oliver Sander
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Sander 2017-08-24 10:28:11 UTC
Created attachment 107495 [details]
screenshot showing the problem

A certain zoom levels I see small rendering artifacts at the page boundaries (see attached screenshot).  These happen with and without the code from the gsoc2017_hidpi_support branch).
Comment 1 null 2017-08-24 20:44:02 UTC
To reproduce, set QT_SCREEN_SCALE_FACTORS=2 (I guess this context is missing here ;). For a nice and flickery animation of the artifacts, try changing the window width.

Tested with Qt 5.9.1.
Comment 2 Nate Graham 2017-10-15 02:39:45 UTC
HiDPI support landed today with https://cgit.kde.org/okular.git/commit/?id=ecc1141e0293e1a30e0f8787d86dcc6309ffb0c0
Comment 3 Oliver Sander 2019-07-01 12:09:58 UTC
Git commit c73de7e6a193705de2ae06772d799eadfec9842f by Oliver Sander.
Committed on 01/07/2019 at 12:09.
Pushed by sander into branch 'fix-bug-383943-hidpi-glitches'.

Make page boundary rendering more robust

Okular renders a simple 'shadow' at the right and the bottom of each
page.  The code for this is a bit fragile:  After the page is rendered,
Okular paints a black outline, and then the shadow.  The shadow is
a hand-implemented gradient, painted line by line.  Finally, the
remaining area is painted in the background color.  No pixel is
ever touched twice.  Unfortunately, the code is buggy, and in hidpi /
fractional scaling situations, some pixels are never touched.
This results in rendering glitches as reported in

  https://bugs.kde.org/show_bug.cgi?id=383943

Instead of trying to fix the previous approach, this patch makes the
code more robust by changing the order of the painting operations.
After painting the page, the code now first paints the background,
which is now enlarged to cover everything off the page.  Finally,
the black outline and shadow are drawn on the previously drawn
background.  This makes sures that no pixel is ever left uninitialized.
It also allows to simplify the shadow drawing operation a bit.

M  +41   -28   ui/pageview.cpp

https://invent.kde.org/kde/okular/commit/c73de7e6a193705de2ae06772d799eadfec9842f
Comment 4 Oliver Sander 2019-07-01 12:16:02 UTC
Git commit dec6923c56a99dc7bdf59c890c0ee310fb12fc23 by Oliver Sander.
Committed on 01/07/2019 at 12:12.
Pushed by sander into branch 'fix-bug-383943-hidpi-glitches'.

Make page boundary rendering more robust

Okular renders a simple 'shadow' at the right and the bottom of each
page.  The code for this is a bit fragile:  After the page is rendered,
Okular paints a black outline, and then the shadow.  The shadow is
a hand-implemented gradient, painted line by line.  Finally, the
remaining area is painted in the background color.  No pixel is
ever touched twice.  Unfortunately, the code is buggy, and in hidpi /
fractional scaling situations, some pixels are never touched.
This results in rendering glitches as reported in

  https://bugs.kde.org/show_bug.cgi?id=383943

Instead of trying to fix the previous approach, this patch makes the
code more robust by changing the order of the painting operations.
After painting the page, the code now first paints the background,
which is now enlarged to cover everything off the page.  Finally,
the black outline and shadow are drawn on the previously drawn
background.  This makes sures that no pixel is ever left uninitialized.
It also allows to simplify the shadow drawing operation a bit.

M  +41   -28   ui/pageview.cpp

https://invent.kde.org/kde/okular/commit/dec6923c56a99dc7bdf59c890c0ee310fb12fc23
Comment 5 Oliver Sander 2019-07-01 12:22:45 UTC
This issue was closed by accident with Comment 2.  However, the patch mentioned there does not actually fix the problem.  The commits that lead to Comment 3 and Comment 4 do fix the issue, but note that they are on a feature branch, not on master. Hence, the issue is still open, but there is a patch at

  https://invent.kde.org/kde/okular/merge_requests/6.
Comment 6 Albert Astals Cid 2019-07-17 19:54:39 UTC
Git commit 9b34bfb45eee81bf486c02eaed23d20a1ba68446 by Albert Astals Cid, on behalf of Oliver Sander.
Committed on 17/07/2019 at 19:46.
Pushed by aacid into branch 'Applications/19.08'.

Make page boundary rendering more robust

Okular renders a simple 'shadow' at the right and the bottom of each
page.  The code for this is a bit fragile:  After the page is rendered,
Okular paints a black outline, and then the shadow.  The shadow is
a hand-implemented gradient, painted line by line.  Finally, the
remaining area is painted in the background color.  No pixel is
ever touched twice.  Unfortunately, the code is buggy, and in hidpi /
fractional scaling situations, some pixels are never touched.
This results in rendering glitches as reported in

  https://bugs.kde.org/show_bug.cgi?id=383943

Instead of trying to fix the previous approach, this patch makes the
code more robust by changing the order of the painting operations.
After painting the page, the code now first paints the background,
which is now enlarged to cover everything off the page.  Finally,
the black outline and shadow are drawn on the previously drawn
background.  This makes sures that no pixel is ever left uninitialized.
It also allows to simplify the shadow drawing operation a bit.

M  +47   -35   ui/pageview.cpp

https://invent.kde.org/kde/okular/commit/9b34bfb45eee81bf486c02eaed23d20a1ba68446