Summary: | Elliptical selection tool behaves weird | ||
---|---|---|---|
Product: | [Applications] krita | Reporter: | Andreas <adrasx> |
Component: | Tools/Selection | Assignee: | Dmitry Kazakov <dimula73> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | dimula73, griffinvalley, halla |
Priority: | NOR | ||
Version: | 4.2.5 | ||
Target Milestone: | --- | ||
Platform: | Microsoft Windows | ||
OS: | Microsoft Windows | ||
Latest Commit: | https://invent.kde.org/graphics/krita/commit/8a5135870197c5d93f9aac7f8cb67d9389a7503a | Version Fixed In: | |
Attachments: |
File with odd selections.
Bug reproduced with normal shapes |
Description
Andreas
2019-08-19 11:14:53 UTC
Created attachment 122241 [details]
File with odd selections.
Yeah, I can reproduce this.
mode: vector
action: replace
I think it might actually be the union boolean operator freaking out? This only really happens when using shift+draw.
Last time I got this, the selection width and height of the last drawn ellipse were 21 high and 24 wide.
We're not sure we can actually fix this, since it's part of the way QPainterPath works. Almost a duplicate of 381925? The main problem happens in QPathClipper::clip(). If the newly added ellipse does *not* intersect with the bounding rect of the original selection, then it is just added to the original path with full quality without any clipping. Although if the original bounding rect intersects the new ellipse, then clipping algorithm starts and breaks the curves into segments. Okay, the bug is related to bug 381925, but it is different and may be fixed without rewriting Qt's paths code. The problem is that we measure all our shapes (and vector selections) in 'pt' units. And Qt has heuristic algorithm for linearization of the curves when clipping, and this algorithm uses absolute measurements of the path to split it. The fix for the bug should include: 1) Make KisShapeSelection use image pixels instead of points 2) Make KisShapeLayer use image pixels as a base coordinate system instead of points as well (the bug is reproducible with normal shapes as well) 3) Make KisShapeLayer::transform() actually transform shapes instead of applying a higher-level matrix on the top of them. As an alternative, we could just make a simple function for boolean transformation of QPainterPath in the shapes, which would upscale them into a proper scale. The only drawback is that we should locate all the places where we use path-boolean-operations for that. Created attachment 128387 [details]
Bug reproduced with normal shapes
Git commit 64e4de6c6c80686281cdb74a53eaf88ddafd6b5a by Dmitry Kazakov. Committed on 12/05/2020 at 18:48. Pushed by dkazakov into branch 'master'. Add a workaround for boolean operations on shapes The problem is that Qt's path boolean operation do not support curves, therefore all the curves are converted into lines (see QPathSegments::addPath()). The curves are split into lines using absolute size of the curve for the threshold. Therefore, when applying boolean operations we should convert them into 'image pixel' coordinate space first. M +7 -0 libs/image/krita_utils.cpp M +17 -0 libs/image/krita_utils.h M +13 -5 libs/ui/flake/kis_shape_selection.cpp M +9 -1 libs/ui/tool/kis_selection_tool_helper.cpp M +12 -1 plugins/tools/defaulttool/defaulttool/DefaultTool.cpp https://invent.kde.org/kde/krita/commit/64e4de6c6c80686281cdb74a53eaf88ddafd6b5a Git commit 8a5135870197c5d93f9aac7f8cb67d9389a7503a by Dmitry Kazakov. Committed on 02/06/2020 at 10:06. Pushed by dkazakov into branch 'krita/4.3'. Add a workaround for boolean operations on shapes The problem is that Qt's path boolean operation do not support curves, therefore all the curves are converted into lines (see QPathSegments::addPath()). The curves are split into lines using absolute size of the curve for the threshold. Therefore, when applying boolean operations we should convert them into 'image pixel' coordinate space first. M +7 -0 libs/image/krita_utils.cpp M +17 -0 libs/image/krita_utils.h M +13 -5 libs/ui/flake/kis_shape_selection.cpp M +9 -1 libs/ui/tool/kis_selection_tool_helper.cpp M +12 -1 plugins/tools/defaulttool/defaulttool/DefaultTool.cpp https://invent.kde.org/graphics/krita/commit/8a5135870197c5d93f9aac7f8cb67d9389a7503a |