Bug 438852 - border appears after applying filter
Summary: border appears after applying filter
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Filters (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Other Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-06-18 09:59 UTC by mcoudert
Modified: 2021-07-27 10:18 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
before filter (24.21 KB, image/jpeg)
2021-06-18 10:00 UTC, mcoudert
Details
After filter (36.92 KB, image/jpeg)
2021-06-18 10:00 UTC, mcoudert
Details
test-image (560.21 KB, image/jpeg)
2021-06-21 07:17 UTC, mcoudert
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mcoudert 2021-06-18 09:59:43 UTC
SUMMARY
when applying a filter (more visible whith sharpen filter), a border appears on the right side of the image.

STEPS TO REPRODUCE
1. open a file (ex. jpg)
2. apply a sharpen filter on the image

OBSERVED RESULT
a 1 pixel white border has appeared on the right side of the image

EXPECTED RESULT
no border

SOFTWARE/OS VERSIONS
Windows: 10 21H1
Krita
  Version: 5.0.0-prealpha (git a790876)

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.19043
  Pretty Productname: Windows 10 (10.0)
  Product Type: windows
  Product Version: 10


OpenGL Info
 
  Vendor:  "Google Inc." 
  Renderer:  "ANGLE (NVIDIA GeForce GTX 1070 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
 Memory: 31 Gb
 Cores: 16

ADDITIONAL INFORMATION
more infos here : https://krita-artists.org/t/krita5-filter-1-pixel-white-band-preview-checkbox-crash/25290
Comment 1 mcoudert 2021-06-18 10:00:10 UTC
Created attachment 139471 [details]
before filter
Comment 2 mcoudert 2021-06-18 10:00:38 UTC
Created attachment 139472 [details]
After filter
Comment 3 Ahab Greybeard 2021-06-18 14:04:37 UTC
Testing with the Jun 17 5.0.0-prealpha (git 76b3db3) appimage on Debian 10, I don't see that white line appear when Sharpen is used.

There is a 1 px wide effect on the right and bottom edge that gives a very slight increase in brightness which is only noticeable with a very dark image, not with a pure black image.
Comment 4 mcoudert 2021-06-21 07:16:27 UTC
(In reply to Ahab Greybeard from comment #3)
> Testing with the Jun 17 5.0.0-prealpha (git 76b3db3) appimage on Debian 10,
> I don't see that white line appear when Sharpen is used.
> 
> There is a 1 px wide effect on the right and bottom edge that gives a very
> slight increase in brightness which is only noticeable with a very dark
> image, not with a pure black image.

i add an image to test the issue with. in krita 5 a border appear, in 4.4.5 no borber.
I've tested with blur and edge detection filter and there is a border on the bottom and right.  Maybe the area for the filter use one pixel out of the canvas.
Comment 5 mcoudert 2021-06-21 07:17:03 UTC
Created attachment 139564 [details]
test-image
Comment 6 Ahab Greybeard 2021-06-21 08:01:41 UTC
Setting to confirmed.

With the Sharpen filter, the effect and its visibility depends on the lightness on the image pixels at the edge.
At first, I tested with an image that was quite dark at the edges. The effect is greater for lighter coloured pixels.

With the Gaussian Blur filter, there is a different effect where the right and bottom edge have a reduction of opacity. How far this extends into the image is proportional to the radius of the blur used.
Again, this depends on the lightness of the image and the effect is not noticeable with dark images.

This does not happen with 4.4.5, hence regression.
Comment 7 Dmitry Kazakov 2021-07-27 10:18:22 UTC
Git commit 9a9fe379855679ebe5c6ef7b36a59152640f1347 by Dmitry Kazakov.
Committed on 27/07/2021 at 10:18.
Pushed by dkazakov into branch 'master'.

Fix multiple issues in the new implementation of the filter stroke

1) Apply rect should not be bigger than the size of the image,
   otherwise bug 438852 appears.

2) When cancelling the filtering to apply a different filter
   configuration, we should should inhibit the updates to avoid
   flickering. It became broken after porting to undo-based
   stretegy (because this strategy uses mutated jobs).

3) When silently cancelling the stroke we should save the updates
   somewhere externally, so that the next stroke can update this area.
   Previously, this problem was solved by ExtraCleanUpUpdates, which
   became broken during the refactoring. Now there is a shared data
   structure ExternalCancelUpdatesStorage, which passes proper update
   rects between the strokes.

M  +8    -3    libs/image/kis_stroke_strategy_undo_command_based.cpp
M  +1    -1    libs/image/kis_stroke_strategy_undo_command_based.h
M  +11   -39   libs/ui/kis_filter_manager.cc
M  +93   -49   libs/ui/tool/strokes/kis_filter_stroke_strategy.cpp
M  +10   -25   libs/ui/tool/strokes/kis_filter_stroke_strategy.h

https://invent.kde.org/graphics/krita/commit/9a9fe379855679ebe5c6ef7b36a59152640f1347