Proper fix to bug 385521
When I was figuring out how to get the gradient brushes to preview with the currently selected gradient instead of the default "Foreground to Background" gradient I have brushes load in the constructor, I came across a comment about bug:385521 in KisPresetLivePreviewView::setupAndPaintStroke(). Instead of fixing the bug (gradient color source caused crash) properly, it just made it use a plain color source. I changed it to pass the resourceManager from KisPaintOpPresetsPopup to KisPresetLivePreviewView to KisResourcesSnapshot (which wanted it anyway). Just passing it there fixed both this bug and my original problem.
Gradient brushtips and regular brushes with gradient color source now display correctly in the preview without crashing.
Test Plan
For krita/4.3: Have a gradient that is easily discernible selected, and any pixel brush selected. Open up brush settings and change the color source to gradient, and check the Mix checkbox. You should see the preview display the gradient.
For my branch voronwe/gradient4.3: This fix is already merged into my branch, and it enables gradient brushtips to display the current selected gradient instead of the default gradient in the preview window. To test this functionality, make sure a gradient other than "Foreground to Background" is selected, load a brush with an RGBA brushtip, and select Gradient as the brush type. You should see the currently selected gradient mapped to the gray values of the brushtip.
Formalities Checklist
-
I confirmed this builds. -
I confirmed Krita ran and the relevant functions work. -
I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!) -
I made sure my commits build individually and have good descriptions as per KDE guidelines. -
I made sure my code conforms to the standards set in the HACKING file. -
I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.