Bug 441216 - Painting over a reference image shows rectangular artefacts around the cursor if fractional HiDPI scaling is enabled.
Summary: Painting over a reference image shows rectangular artefacts around the cursor...
Status: REOPENED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 4.4.7
Platform: Microsoft Windows Microsoft Windows
: NOR minor
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-08-20 08:27 UTC by sven.wanner
Modified: 2024-06-06 09:23 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
screenshot of visual bug (160.17 KB, image/jpeg)
2021-08-20 08:27 UTC, sven.wanner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sven.wanner 2021-08-20 08:27:50 UTC
Created attachment 140867 [details]
screenshot of visual bug

SUMMARY
Updated to 4.4.7 and now the tools create a rectange artefact trail on moving. Impossible to use anymore...

STEPS TO REPRODUCE
1. attached a screenshot
2. 
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Halla Rempt 2021-08-20 08:52:17 UTC
* Please provide the system information for bug reports.
* Do you have a reference image on top of your canvas?
Comment 2 sven.wanner 2021-08-20 09:07:55 UTC
Both you're requesting I think I've already added. MS Windows 10 and a screenshot is attached, too.
Comment 3 Halla Rempt 2021-08-20 09:11:17 UTC
No, go to help->system information for bug reports, and paste the contents in this bug report. And you have not said whether there is a reference image on top of your canvas.
Comment 4 sven.wanner 2021-08-20 09:30:41 UTC
Sorry, now I got it. Yes, I had a reference image loaded when the problem occured, didn't test without one, because I just opened my current project and rolled back to 4.4.3 right after observing the bug.



Krita

 Version: 4.4.3
 Languages: en_US, en
 Hidpi: true

Qt

  Version (compiled): 5.12.9
  Version (loaded): 5.12.9

OS Information

  Build ABI: x86_64-little_endian-llp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: winnt
  Kernel Version: 10.0.19042
  Pretty Productname: Windows 10 (10.0)
  Product Type: windows
  Product Version: 10

OpenGL Info
 
  Vendor:  "Google Inc." 
  Renderer:  "ANGLE (Intel(R) UHD Graphics 630 Direct3D11 vs_5_0 ps_5_0)" 
  Version:  "OpenGL ES 3.0 (ANGLE 2.1.0.57ea533f79a7)" 
  Shading language:  "OpenGL ES GLSL ES 3.00 (ANGLE 2.1.0.57ea533f79a7)" 
  Requested format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
  Current format:    QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile) 
     Version: 3.0
     Supports deprecated functions false 
     is OpenGL ES: true 

QPA OpenGL Detection Info 
  supportsDesktopGL: true 
  supportsAngleD3D11: true 
  isQtPreferAngle: true 

Hardware Information

  GPU Acceleration: auto
  Memory: 16282 Mb
  Number of Cores: 12
  Swap Location: 

Current Settings

  Current Swap Location: 
  Current Swap Location writable: true
  Undo Enabled: true
  Undo Stack Limit: 30
  Use OpenGL: true
  Use OpenGL Texture Buffer: true
  Use AMD Vectorization Workaround: false
  Canvas State: OPENGL_SUCCESS
  Autosave Interval: 900
  Use Backup Files: true
  Number of Backups Kept: 1
  Backup File Suffix: ~
  Backup Location: Same Folder as the File
  Backup Location writable: false
  Use Win8 Pointer Input: false
  Use RightMiddleTabletButton Workaround: false
  Levels of Detail Enabled: false
  Use Zip64: false


Display Information
Number of screens: 1
	Screen: 0
		Name: \\.\DISPLAY1
		Depth: 32
		Scale: 1
		Resolution in pixels: 1920x1080
		Manufacturer: 
		Model: 
		Refresh Rate: 144
Comment 5 Halla Rempt 2021-08-20 10:05:19 UTC
Okay, then I can confirm: I've seen this with a reference image as well, but not without one. I never noticed before because I usually do not trace over a reference image, but have one besides my canvas.
Comment 6 Halla Rempt 2021-08-21 09:54:22 UTC
Ah, and you're using Krita 4.4.3 so it isn't a recent regression.
Comment 7 Halla Rempt 2021-08-21 09:54:59 UTC
Argh, no I misread, sorry.
Comment 8 Halla Rempt 2021-08-23 10:56:42 UTC
If you disable fractional hidpi scaling in Krita's settings, then 4.4.7 will not show the cursor artefacts anymore.
Comment 9 sven.wanner 2021-08-23 11:06:47 UTC
Unfortunately this doesn't work in my case. I also tried to disable Hi-DPI support completely, no effect!
Comment 10 Halla Rempt 2021-08-23 12:30:12 UTC
That's strange... I just checked on my Yoga, set display scaling to 1, like you have, and I didn't get any artefacts anymore. And I set it to 1.25, and then disabled fractional scaling support, and didn't get artefacts; when I enabled it, I did.
Comment 11 sven.wanner 2021-08-23 13:01:27 UTC
Now that I reinstalled 4.4.7 to test your recommendation I can tell you that I not only see artefacts in case of drawing on reference images, even if they are more massive, but I also see some without reference images. When moving the pencil, vertical and horizontal strokes appear and also vanishing again after a while or on rotating and zooming the canvas. The length seems to somehow correlate to the rotation of the canvas, on higher rotations just dot appear sometimes. Will go back to 4.4.3 again, if it is a bigger issue you might get more and maybe better feedback from others soon. Thank you for helping.
Comment 12 Freya Lupen 2022-07-28 00:00:31 UTC
Looked into this bug (can confirm in 5.1.0 beta 1 and recent master), and here's my findings:
When moving a brush outline cursor over a reference image with fractional display scaling,
1-screen-pixel-wide/tall transparent lines appear at the left and bottom edges of the update rect.

Changing this line in KisOpenGLCanvas2::paintGL()
            gc.setClipRect(updateRect);
to this
            gc.setClipRect(updateRect.adjusted(-1, 0, 0, 1));
prevents them from appearing. I suspect it's some kind of rounding issue in Qt.
Comment 13 Halla Rempt 2022-09-20 09:51:44 UTC
Dmitry said he'll check this solution.
Comment 14 Dmitry Kazakov 2022-09-20 10:24:03 UTC
Git commit 213f967eced91bc22767d700f47d0973b4f681fd by Dmitry Kazakov.
Committed on 20/09/2022 at 10:23.
Pushed by dkazakov into branch 'master'.

Fix artifacts when hovering over reference images in HiDPI mode

Thanks Freya Lupen for the provided patch!

M  +1    -1    libs/ui/opengl/kis_opengl_canvas2.cpp

https://invent.kde.org/graphics/krita/commit/213f967eced91bc22767d700f47d0973b4f681fd
Comment 15 Dmitry Kazakov 2022-09-20 10:24:26 UTC
Git commit fed8729ecd3021fee8ebf1cd6ae9d74453960935 by Dmitry Kazakov.
Committed on 20/09/2022 at 10:24.
Pushed by dkazakov into branch 'krita/5.1'.

Fix artifacts when hovering over reference images in HiDPI mode

Thanks Freya Lupen for the provided patch!


(cherry picked from commit 213f967eced91bc22767d700f47d0973b4f681fd)

M  +1    -1    libs/ui/opengl/kis_opengl_canvas2.cpp

https://invent.kde.org/graphics/krita/commit/fed8729ecd3021fee8ebf1cd6ae9d74453960935
Comment 16 Dmitry Kazakov 2022-11-17 12:25:45 UTC
The fix is reverted currently since it causes bug 460577
Comment 17 Dmitry Kazakov 2022-11-17 13:33:34 UTC
Git commit b18557c58f86429ba728341a4401fba53d42f522 by Dmitry Kazakov.
Committed on 17/11/2022 at 13:33.
Pushed by dkazakov into branch 'master'.

Disable partial updates for fractional HiDPI cases

There is some bug either in QPainter or in our partial updates
patches that cause an update issue in reference images decoration.

Basically, the crop rect of the update should be aligned to the
physical pixels, but it is not.

M  +11   -1    libs/ui/opengl/kis_opengl_canvas2.cpp

https://invent.kde.org/graphics/krita/commit/b18557c58f86429ba728341a4401fba53d42f522
Comment 18 Dmitry Kazakov 2022-11-17 13:33:54 UTC
Git commit ef521dac6125ec718200ca9b689fb7ae69f51482 by Dmitry Kazakov.
Committed on 17/11/2022 at 13:33.
Pushed by dkazakov into branch 'krita/5.1'.

Disable partial updates for fractional HiDPI cases

There is some bug either in QPainter or in our partial updates
patches that cause an update issue in reference images decoration.

Basically, the crop rect of the update should be aligned to the
physical pixels, but it is not.

M  +11   -1    libs/ui/opengl/kis_opengl_canvas2.cpp

https://invent.kde.org/graphics/krita/commit/ef521dac6125ec718200ca9b689fb7ae69f51482
Comment 19 Dmitry Kazakov 2022-11-17 13:35:12 UTC
The bug is currently fixed with a workaround. Now partial updates are completely disabled in fractional HiDPI mode. Ideally, we need to fix that somewhere in Qt.
Comment 20 Alvin Wong 2023-09-14 18:15:22 UTC
Git commit d486a0605f8d120130eaeb09753829a484d9654f by Alvin Wong.
Committed on 14/09/2023 at 20:15.
Pushed by alvinwong into branch 'master'.

Set updateRect to widget rect on fractional hidpi screen

This fixes the warning `KoShapeManager::paint  Painting with a painter
that has no clipping will lead to too much being painted!`, regression
from ef521dac6125ec718200ca9b689fb7ae69f51482.

M  +2    -0    libs/ui/opengl/kis_opengl_canvas2.cpp

https://invent.kde.org/graphics/krita/-/commit/d486a0605f8d120130eaeb09753829a484d9654f
Comment 21 Alvin Wong 2023-09-14 18:15:43 UTC
Git commit 3323e4e3308ce413e8439536285e42814ce628c8 by Alvin Wong.
Committed on 14/09/2023 at 20:15.
Pushed by alvinwong into branch 'krita/5.2'.

Set updateRect to widget rect on fractional hidpi screen

This fixes the warning `KoShapeManager::paint  Painting with a painter
that has no clipping will lead to too much being painted!`, regression
from ef521dac6125ec718200ca9b689fb7ae69f51482.
(cherry picked from commit d486a0605f8d120130eaeb09753829a484d9654f)

M  +2    -0    libs/ui/opengl/kis_opengl_canvas2.cpp

https://invent.kde.org/graphics/krita/-/commit/3323e4e3308ce413e8439536285e42814ce628c8