Bug 441649 - random lines appear on canvas and scratchpad while moving the cursor
Summary: random lines appear on canvas and scratchpad while moving the cursor
Status: CONFIRMED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 4.4.8
Platform: Appimage All
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-28 10:49 UTC by Takiro Ryo
Modified: 2022-06-28 12:01 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Takiro Ryo 2021-08-28 10:49:55 UTC
SUMMARY

When moving the cursor over the canvas (no matter if actually drawing or not) weird lines appear on the canvas and on the scratch pad in the brush settings window as if there is a problem with rendering the canvas.

This issue has been reported on Krita-Artist.org a few times already.

From what I was able to test, for me on Linux it seems to be related to UI scaling as it only happened after I got a 4k monitor and had to enable the Systems UI scaling (otherwise Krita's interface is just to small but at least the bug is not visible). However one User reported to not using UI scaling at all, but it still happens. 

The bug has been reported to happen on Windows and Linux so far.

STEPS TO REPRODUCE
1. Have a high resolution screen
2. Enable UI scaling on OS level
3. Start Krita and open a new document
3. Set background layer to something other than white (better visualizes the bug)
4. Move Cursor with brush tool selected across the canvas or try painting

OBSERVED RESULT
Horizontal and vertical lines appear around the cursor. Seemingly a square shape that encloses the brush.

EXPECTED RESULT
Nothing should happen except the actual painting.

ADDITIONAL INFO
The lines are only visually and often disappear when the canvas is refreshed for some reason. the Same happens on the scratchpad. For me the intensity of the lines appearing varies from brush to brush with pixel brushes being the worst and with smudge brushes it doesn't happen as much. Disabling canvas acceleration made it worse for me, changing the renderer to something else than OpenGL was not possible for me on Linux but Windows users reported it made not much of a difference. It seems to even happen when other tools than the brush tools are used (see linked threads).

This happens at least since version 4.4.0 but could be there for longer since I didn't had to use UI scaling before. As more people get higher resolution screens, this seems to affect more users (however one user on windows reported to not use UI scaling but it still happens). 

Here are some example screenshots.

https://krita-artists.org/uploads/default/original/3X/9/c/9c453deb33b3bcdee13bcc42e346ee3a25ed1f76.png

https://krita-artists.org/uploads/default/original/3X/e/8/e8dada204e0a6b91bd234e145453d3bcdbb310fb.png

https://krita-artists.org/uploads/default/original/3X/b/4/b4250b339c89a3171654030461a310e8ec5a24fe.jpeg

Here are a few related threads on krita-artists.org:

https://krita-artists.org/t/weird-artifacts-in-viewport-windows-10/28178

https://krita-artists.org/t/issue-while-moving-the-pen-around/28109

https://krita-artists.org/t/lines-apearing-when-cropping-ect/27372

These are a few but there are more. Currently the community didn't found a solution.
Comment 1 Takiro Ryo 2021-08-28 10:51:11 UTC
I set this to confirmed because it already affects multiple users.
Comment 2 Alvin Wong 2021-08-28 11:42:09 UTC
I can reproduce such lines, but only on the scratchpad and only when a fractional Hi-DPI scaling (150% or 175%) is being used. No issues at 200%.
Comment 3 Takiro Ryo 2021-08-28 12:55:16 UTC
Yes, I checked it and it stops happening at 200%, then it works fine. On everything in between, the lines are back.

In Windows there seems to be an option "Enable fractional scale factor" (Which is not available on Linux or at least I don't see it in the app image version) but it doesn't seem to help on Windows, at least this user (https://krita-artists.org/t/weird-artifacts-in-viewport-windows-10/28178/4?u=takiro) writes he has the option enabled and it still happens for them with a scaling of 125%.
Comment 4 Alvin Wong 2021-08-28 13:14:22 UTC
(In reply to Takiro Ryo from comment #3)
> In Windows there seems to be an option "Enable fractional scale factor"
> (Which is not available on Linux or at least I don't see it in the app image
> version) but it doesn't seem to help on Windows, at least this user
> (https://krita-artists.org/t/weird-artifacts-in-viewport-windows-10/28178/
> 4?u=takiro) writes he has the option enabled and it still happens for them
> with a scaling of 125%.

Well, having the option enable *causes* this issue to show up.
Comment 5 Takiro Ryo 2021-08-28 13:51:58 UTC
(In reply to Alvin Wong from comment #4)

> Well, having the option enable *causes* this issue to show up.

I see, I didn't understand what it was for, I read it just now. It seems to be enabled by default, right now. At least knowing this, I could help a few users already, users with small enough displays that they can disable it and do without scaling.
Comment 6 Alvin Wong 2021-09-20 16:50:25 UTC
It seems to be the same thing as QTBUG-78963 [1]. I guess the linked patch [2] might help a bit, worth trying?

[1]: https://bugreports.qt.io/browse/QTBUG-78963
[2]: https://codereview.qt-project.org/c/qt/qtbase/+/278047
Comment 7 Alvin Wong 2021-09-20 17:02:02 UTC
This might also help: https://codereview.qt-project.org/c/qt/qtbase/+/308500
Comment 8 Alvin Wong 2021-09-22 08:59:47 UTC
Git commit a2b87cf71b7d0a1079842d60c0431acce50c2fb0 by Alvin Wong.
Committed on 22/09/2021 at 08:53.
Pushed by alvinwong into branch 'master'.

Backport Qt patches to fix paint artifacts on fractional scaling

Backported three changes:

- https://codereview.qt-project.org/c/qt/qtbase/+/249023
- https://codereview.qt-project.org/c/qt/qtbase/+/278047
- https://codereview.qt-project.org/c/qt/qtbase/+/308500

M  +20   -0    3rdparty/ext_qt/CMakeLists.txt
A  +120  -0    3rdparty/ext_qt/frac_dpi_paint_artifacts/0001-Add-faster-path-for-scaling-QRegion-with-multiple-re.patch
A  +128  -0    3rdparty/ext_qt/frac_dpi_paint_artifacts/0002-Fix-QPainter-off-by-one-clipping-for-some-non-intege.patch
A  +35   -0    3rdparty/ext_qt/frac_dpi_paint_artifacts/0003-Fix-under-non-integer-scaling-incorrect-update-area.patch

https://invent.kde.org/graphics/krita/commit/a2b87cf71b7d0a1079842d60c0431acce50c2fb0
Comment 9 Alvin Wong 2021-09-22 09:00:26 UTC
Git commit cc3f4e4f89439a873de77e1b83b6a9af35c16d98 by Alvin Wong.
Committed on 22/09/2021 at 09:00.
Pushed by alvinwong into branch 'krita/5.0'.

Backport Qt patches to fix paint artifacts on fractional scaling

Backported three changes:

- https://codereview.qt-project.org/c/qt/qtbase/+/249023
- https://codereview.qt-project.org/c/qt/qtbase/+/278047
- https://codereview.qt-project.org/c/qt/qtbase/+/308500


(cherry picked from commit a2b87cf71b7d0a1079842d60c0431acce50c2fb0)

M  +20   -0    3rdparty/ext_qt/CMakeLists.txt
A  +120  -0    3rdparty/ext_qt/frac_dpi_paint_artifacts/0001-Add-faster-path-for-scaling-QRegion-with-multiple-re.patch
A  +128  -0    3rdparty/ext_qt/frac_dpi_paint_artifacts/0002-Fix-QPainter-off-by-one-clipping-for-some-non-intege.patch
A  +35   -0    3rdparty/ext_qt/frac_dpi_paint_artifacts/0003-Fix-under-non-integer-scaling-incorrect-update-area.patch

https://invent.kde.org/graphics/krita/commit/cc3f4e4f89439a873de77e1b83b6a9af35c16d98
Comment 10 Dmitry Kazakov 2021-09-22 12:42:05 UTC
The bug should be fixed in this commit:

https://invent.kde.org/graphics/krita/-/commit/f5255d4e73d0a92e5e48f823a89e17436d286394
Comment 11 Dmitry Kazakov 2021-09-22 12:44:00 UTC
Okay, QPainter canvas and Scratchpad are still affected
Comment 12 Alvin Wong 2021-09-22 15:41:36 UTC
After backporting the Qt patches (a2b87cf71b7d0a1079842d60c0431acce50c2fb0), there seems to be a improvement to the QPainter canvas and scratchpad, *if* desktop OpenGL has been loaded. When ANGLE is loaded instead, they still produce a lot of black lines artifacts for me (testing with 1.1x scaling).
Comment 13 Halla Rempt 2022-06-28 12:01:51 UTC
Setting to confirmed, then.