Bug 411875 - Undo Image->trim to selection shifts selection by constant amount
Summary: Undo Image->trim to selection shifts selection by constant amount
Status: RESOLVED DUPLICATE of bug 411802
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 4.2.6
Platform: Other Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-12 23:14 UTC by jamesnoeckel
Modified: 2020-06-03 12:42 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
initial selection (227.22 KB, image/png)
2019-09-13 17:15 UTC, jamesnoeckel
Details
step 2: trim to selection (141.05 KB, image/png)
2019-09-13 17:17 UTC, jamesnoeckel
Details
step3: undo (221.67 KB, image/png)
2019-09-13 17:17 UTC, jamesnoeckel
Details
step 4: redo and undo again (223.58 KB, image/png)
2019-09-13 17:17 UTC, jamesnoeckel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jamesnoeckel 2019-09-12 23:14:25 UTC
SUMMARY
Undoing trimming the image to selection causes the selection to jump to a wrong location in the image while retaining its shape.

STEPS TO REPRODUCE
1. Select part of the image with rectangle (or any) tool
2. Image -> Trim to selection
3. Undo

OBSERVED RESULT
Selection is not in the place where you originally selected, though it is the same shape

EXPECTED RESULT
Undo should restore the previous state of the program

SOFTWARE/OS VERSIONS
Windows: 10

ADDITIONAL INFORMATION
Every time you undo/redo, the selection shifts some more by some fixed amount, it seems.
Comment 1 Ahab Greybeard 2019-09-13 15:34:37 UTC
I don't see any sign of this with Krita 4.2.6 on Windows 10 after repeated Trim to Selection followed by Undo actions.

I used a simple newly created document with one transparent layer over the standard white background.

Can you provide before and after screenshots to illustrate what you see?
Comment 2 jamesnoeckel 2019-09-13 17:15:49 UTC
Created attachment 122643 [details]
initial selection
Comment 3 jamesnoeckel 2019-09-13 17:17:08 UTC
Created attachment 122644 [details]
step 2: trim to selection

For a split second when selecting trim to selection, the selection appears offset from the resized image boundaries, before jumping into place. That offset appears to be exactly the offset that gets applied to the selection when you undo the operation.
Comment 4 jamesnoeckel 2019-09-13 17:17:30 UTC
Created attachment 122645 [details]
step3: undo
Comment 5 jamesnoeckel 2019-09-13 17:17:56 UTC
Created attachment 122646 [details]
step 4: redo and undo again
Comment 6 jamesnoeckel 2019-09-13 17:20:22 UTC
looking at these images, I am almost certain that the offset applied is exactly the offset of the selection to the top left corner of the image. Some correction term getting applied twice somewhere.
Comment 7 jamesnoeckel 2019-09-13 17:28:57 UTC
also happens in the Linux 4.2.6 appimage. In fact, I scribbled on the transparent layer and in addition to the selection being shifted down and right, the top layer got shifted up and left so that the scribble was cut off. But while the selection bug happens every time, the layer getting shifted is hard to reproduce.
Comment 8 jamesnoeckel 2019-09-13 17:31:27 UTC
In all cases, however, there is a short interval after cropping/undoing when everything is shifted (the layers slide out of the image boundaries and the selection is out of bounds) before it corrects itself. I guess sometimes it doesn't correct itself.
Comment 9 Ahab Greybeard 2019-09-13 18:42:13 UTC
With the 4.2.6 appimage on Linux, I don't have that offeset after Undo.

I do see the transient selection offset as Trim is being performed (especially now I'm replicating your image and using a small selection). The transient offset appears to be equal to the initial selection offset from the top left corner, as you noted.

Even with a large selection, I don't see any transient shift in the image layer itself.

I've tried it with Image Preview on/off and Graphics Acceleration on/off and that made no difference. Does that make any difference for you?

My PC is not particularly powerful (2x Xeon E5450 @3GHz):

Hardware Information

  GPU Acceleration: auto
  Memory: 16039 Mb
  Number of Cores: 8
  Swap Location: /tmp

OpenGL Info
 
  Vendor:  "NVIDIA Corporation" 
  Renderer:  "GeForce GTX 750 Ti/PCIe/SSE2" 
  Version:  "4.6.0 NVIDIA 418.74" 
  Shading language:  "4.60 NVIDIA" 
  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 4.6, 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) 
     Version: 4.6
     Supports deprecated functions true 
     is OpenGL ES: false 

I can't think of anything else to try.
Comment 10 jamesnoeckel 2019-09-13 21:30:44 UTC
I'm starting with the 1024x1024 texture preset. Though that wasn't the only one that caused the bug, that's the one I'm on now, if it helps. I've done nothing aside from start the program and create a new canvas before crop and undo. Large selections are affected too, and shift out of bounds.
Happens to me both in Linux and Windows, but on the Linux workstation, specs are:
Ubuntu 18.04
Graphics: Quadro RTX 8000
Memory: 50GB

Krita renderer: OpenGL
Scaling mode: High quality filtering

What you posted looks like a debug dump from krita but I'm unfamiliar with that feature, so hopefully that's good enough.
Comment 11 jamesnoeckel 2019-09-13 21:34:42 UTC
Hardware Information

  GPU Acceleration: auto
  Memory: 48201 Mb
  Number of Cores: 40
  Swap Location: /tmp


OpenGL Info
 
  Vendor:  "NVIDIA Corporation" 
  Renderer:  "Quadro RTX 8000/PCIe/SSE2" 
  Version:  "4.6.0 NVIDIA 435.12" 
  Shading language:  "4.60 NVIDIA" 
  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 4.6, 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) 
     Version: 4.6
     Supports deprecated functions true 
     is OpenGL ES: false 

QPA OpenGL Detection Info 
  supportsDesktopGL: true 
  supportsOpenGLES: true 
  isQtPreferOpenGLES: false 
== log ==
 Supported renderers: QFlags(0x2|0x4) 
Surface format preference list: 
* 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) 
    2 
* 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) 
    4 
Probing format... QSurfaceFormat::DefaultColorSpace 2 
Found 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) 
    2
Comment 12 Bug Janitor Service 2019-09-14 04:33:14 UTC
Thanks for your comment!

Automatically switching the status of this bug to REPORTED so that the KDE team
knows that the bug is ready to get confirmed.

In the future you may also do this yourself when providing needed information.
Comment 13 jamesnoeckel 2019-09-16 17:31:09 UTC
also verified on my mac. Strange that there are reproducibility problems on your end.
Comment 14 vanyossi 2019-09-19 00:30:13 UTC
I can confirm this bug.

This happens only with selections made dragging the cursor

Rectangle
Circle
Outline

Tested in master and 4.2.6
Comment 15 Dmitry Kazakov 2020-06-03 12:42:07 UTC
The bug has been fixed by the commit for bug 411802. The fix will be available in Krita 4.3.1.

*** This bug has been marked as a duplicate of bug 411802 ***