Bug 360686

Summary: Changing brush size before instant preview puts real strokes on canvas drastically affects final result
Product: [Applications] krita Reporter: Rastaban26 <regulus2626>
Component: Brush enginesAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: halla
Priority: NOR    
Version First Reported In: 3.0 Alpha   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
URL: http://sta.sh/21ou4cpmi1gp
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Rastaban26 2016-03-18 05:46:42 UTC
If the brush size is being changed (by drag, slider or shortcuts) after making few strokes (large size) but before instant preview mode actually add those strokes to the canvas (when the processing progress bar is visible, see 001.jpg), the final result will be a mix of large size brush (initial size) and the small brush size (value after resizing) - 003.jpg. 
Also right after brush strokes processing is finished some graphical artifacts are visible (002.jpg) which require hiding and revealing layers to make them go away.

Reproducible: Always

Steps to Reproduce:
1. Create a canvas 5000 x 3000 px.
2. Make sure the instant preview mode is ON
3. Resize your brush to 1000 px
4. Make few quick strokes on the screen. (001.jpg - in my case strokes ware made from up to bottom starting from the right side of the canvas, going to the left with every stroke)
5. Krita will respond with rendering a preview of those brush strokes in smaller resolution (Instant preview mode) and starts to work on applying them to the full size image (progress bar: freehand brush stroke)
6. Make your brush size much smaller - in my case: about 30 px
7. Wait for the brush strokes processing to finish.

Actual Results:  
The effect of the processing is an image containing completely different strokes than ware seen during the preview. Also some graphical artifacts are included.
Reference image: 002.jpg

After removing the artifacts by making layers invisible and visible again, the final result shows, that changing the brush size while processing affected the final result.
Reference image: 003.jpg

It seems that the brush size is somehow becoming more global and going outside of the scope of specific brush stroke.

Expected Results:  
Brush size (with it's change during making a stroke) should not be affected by brush size change during stroke processing. As the expected correct results: every stroke should be more similar to those visible during the preview

CPU: Intel i5-3210M @2.50 GHz
Memory: 8 GB
System: Windows 7 64b
GPU: NVIDIA GeForce GT 630M
Tablet: Wacom Bamboo
Comment 1 Halla Rempt 2016-03-18 08:21:17 UTC
Hi, thanks for your report. I haven't been able to reproduce (my system might just be too fast for this to happen), but I'll ask around if others have seen it happen.
Comment 2 Rastaban26 2016-03-19 07:57:44 UTC
(In reply to Boudewijn Rempt from comment #1)
> Hi, thanks for your report. I haven't been able to reproduce (my system
> might just be too fast for this to happen), but I'll ask around if others
> have seen it happen.

Hello,
I can try to record a video demonstrating this behavior if that would be helpful :)
Comment 3 Halla Rempt 2016-03-19 08:49:07 UTC
It might be useful, but I'm first going to talk about this issue with Dmitry, who wrote the code.
Comment 4 Halla Rempt 2016-03-19 12:52:06 UTC
Wolthere confirms.
Comment 5 Dmitry Kazakov 2016-03-24 12:15:53 UTC
Git commit d37d25280db635e0b8aec7d270728bc44cd857fe by Dmitry Kazakov.
Committed on 24/03/2016 at 12:12.
Pushed by dkazakov into branch 'master'.

Clone a preset when creating a stroke's resources snapshot

Fixes T1870

M  +14   -0    benchmarks/kis_stroke_benchmark.cpp
M  +2    -0    benchmarks/kis_stroke_benchmark.h
M  +9    -1    libs/ui/tool/kis_resources_snapshot.cpp

http://commits.kde.org/krita/d37d25280db635e0b8aec7d270728bc44cd857fe