Bug 381732

Summary: (gmic-qt) Problems with layer dimension and position calculations
Product: [Applications] krita Reporter: Nicholas LaPointe <nicholaslapointe8>
Component: G'Mic for KritaAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Demo file

Description Nicholas LaPointe 2017-06-27 15:58:43 UTC
Created attachment 106341 [details]
Demo file

It is easier to notice the first three here when https://phabricator.kde.org/D6409 is applied.

1. A layer with visible dimensions smaller than its actual dimensions will have an unaffected edge after applying the filter. It will also appear similarly cropped in the G'MIC dialog's preview.
Applying the filter "Black & white" -> "Black & white" to the layer "Top-left logo" in the attached file will show this.

2. Layers are only sent to G'MIC in a rectangle given by (0, 0, layerWidth, layerHeight). For example, a 100x100 layer on 0,0 will be okay; the same layer moved to 100,100 will not.

3. If those two are fixed, then it may still be possible that an off-canvas part of a layer will not be affected at all. This also happens in Krita 3.0.1. It can be by tested using "Black & white" on "Partially off-canvas logo" and then moving the layer back onto the canvas.

4. The G'MIC dialog's preview can zoom very differently than it does in the GIMP plug-in. This can be seen by opening krita/pics/app/1024-apps-calligrakrita.png in both GIMP and Krita, then enlarging the canvas to 2048x2048 (with the layer anchored to the top-left). If the canvas is not enlarged, then they will instead zoom with the same appearance.
Comment 1 Nicholas LaPointe 2017-07-13 03:22:00 UTC
Git commit f80c0940d1e1bd94fa137f35510fe4f877c2d227 by Nicholas LaPointe.
Committed on 13/07/2017 at 01:12.
Pushed by nicholasl into branch 'master'.

Fix calculations of source rectangle and selection dimensions when sending data to G'MIC

When there was no selection, the old plug-in would read and write pixels within the rectangle (0,0 canvasWidth x canvasHeight).
The new plug-in was still set up to do this, except it would send the rectangle (0,0 layerWidth x layerHeight) to G'MIC.

When there was a selection in the old plug-in, it would read and write within the selection rectangle.
The new plug-in would read using (0,0 layerWidth x layerHeight), then write inside the selection rectangle.

This commit should reinstate the old behavior.
Differential Revision: https://phabricator.kde.org/D6431

M  +28   -12   plugins/extensions/qmic/QMic.cpp

https://commits.kde.org/krita/f80c0940d1e1bd94fa137f35510fe4f877c2d227
Comment 2 Nicholas LaPointe 2017-07-16 06:29:25 UTC
Git commit 2fe25907c8e022835f2adb2532e61b65500c2ed2 by Nicholas LaPointe.
Committed on 16/07/2017 at 06:23.
Pushed by nicholasl into branch 'krita/3.2'.

Fix calculations of source rectangle and selection dimensions when sending data to G'MIC

When there was no selection, the old plug-in would read and write pixels within the rectangle (0,0 canvasWidth x canvasHeight).
The new plug-in was still set up to do this, except it would send the rectangle (0,0 layerWidth x layerHeight) to G'MIC.

When there was a selection in the old plug-in, it would read and write within the selection rectangle.
The new plug-in would read using (0,0 layerWidth x layerHeight), then write inside the selection rectangle.

This commit should reinstate the old behavior.
Differential Revision: https://phabricator.kde.org/D6431

M  +28   -12   plugins/extensions/qmic/QMic.cpp

https://commits.kde.org/krita/2fe25907c8e022835f2adb2532e61b65500c2ed2