|
Krita Source Code Documentation
|
#include <kis_brushop.h>
Inheritance diagram for KisBrushOp:Classes | |
| struct | UpdateSharedState |
Public Member Functions | |
| std::pair< int, bool > | doAsynchronousUpdate (QVector< KisRunnableStrokeJobData * > &jobs) override |
| KisBrushOp (const KisPaintOpSettingsSP settings, KisPainter *painter, KisNodeSP node, KisImageSP image) | |
| void | paintLine (const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance) override |
| ~KisBrushOp () override | |
Public Member Functions inherited from KisBrushBasedPaintOp | |
| bool | canPaint () const override |
| Reimplemented, false if brush is 0. | |
| bool | checkSizeTooSmall (qreal scale) |
| KisSpacingInformation | effectiveSpacing (qreal scale) const |
| KisSpacingInformation | effectiveSpacing (qreal scale, qreal rotation, const KisAirbrushOptionData *airbrushOption, const KisSpacingOption *spacingOption, const KisPaintInformation &pi) const |
| KisSpacingInformation | effectiveSpacing (qreal scale, qreal rotation, const KisPaintInformation &pi) const |
| KisSpacingInformation | effectiveSpacing (qreal scale, qreal rotation, const KisSpacingOption &spacingOption, const KisPaintInformation &pi) const |
| KisBrushBasedPaintOp (const KisPaintOpSettingsSP settings, KisPainter *painter, KisBrushTextureFlags textureFlags=None) | |
| ~KisBrushBasedPaintOp () override | |
Public Member Functions inherited from KisPaintOp | |
| KisPaintOp (KisPainter *painter) | |
| void | paintAt (const KisPaintInformation &info, KisDistanceInformation *currentDistance) |
| virtual void | paintBezierCurve (const KisPaintInformation &pi1, const QPointF &control1, const QPointF &control2, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance) |
| Private (KisPaintOp *_q) | |
| void | updateSpacing (const KisPaintInformation &info, KisDistanceInformation ¤tDistance) const |
| void | updateTiming (const KisPaintInformation &info, KisDistanceInformation ¤tDistance) const |
| virtual | ~KisPaintOp () |
Public Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Public Member Functions inherited from KisShared | |
| bool | deref () |
| bool | ref () |
| int | refCount () |
| QAtomicInt * | sharedWeakReference () |
Protected Types | |
| typedef QSharedPointer< UpdateSharedState > | UpdateSharedStateSP |
Protected Member Functions | |
| void | addMirroringJobs (Qt::Orientation direction, QVector< QRect > &rects, UpdateSharedStateSP state, QVector< KisRunnableStrokeJobData * > &jobs) |
| KisSpacingInformation | paintAt (const KisPaintInformation &info) override |
| KisSpacingInformation | updateSpacingImpl (const KisPaintInformation &info) const override |
| KisTimingInformation | updateTimingImpl (const KisPaintInformation &info) const override |
Protected Member Functions inherited from KisPaintOp | |
| KisFixedPaintDeviceSP | cachedDab () |
| KisFixedPaintDeviceSP | cachedDab (const KoColorSpace *cs) |
| KisPainter * | painter () const |
| KisPaintDeviceSP | source () const |
Protected Member Functions inherited from KisShared | |
| KisShared () | |
| ~KisShared () | |
Protected Attributes | |
| UpdateSharedStateSP | m_updateSharedState |
Protected Attributes inherited from KisBrushBasedPaintOp | |
| KisBrushSP | m_brush |
| KisDabCache * | m_dabCache |
| KisMirrorOption | m_mirrorOption |
| KisPrecisionOption | m_precisionOption |
Additional Inherited Members | |
Static Public Member Functions inherited from KisBrushBasedPaintOp | |
| static QList< KoResourceLoadResult > | prepareEmbeddedResources (const KisPaintOpSettingsSP settings, KisResourcesInterfaceSP resourcesInterface) |
| static QList< KoResourceLoadResult > | prepareLinkedResources (const KisPaintOpSettingsSP settings, KisResourcesInterfaceSP resourcesInterface) |
Static Public Member Functions inherited from KisPaintOp | |
| static void | splitCoordinate (qreal coordinate, qint32 *whole, qreal *fraction) |
Public Attributes inherited from KisPaintOp | |
| KisFixedPaintDeviceSP | dab |
| bool | fanCornersEnabled {false} |
| qreal | fanCornersStep {1.0} |
| KisPainter * | painter {nullptr} |
| KisPaintOp * | q {nullptr} |
Public Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Definition at line 33 of file kis_brushop.h.
|
protected |
Definition at line 53 of file kis_brushop.h.
| KisBrushOp::KisBrushOp | ( | const KisPaintOpSettingsSP | settings, |
| KisPainter * | painter, | ||
| KisNodeSP | node, | ||
| KisImageSP | image ) |
Definition at line 47 of file kis_brushop.cpp.
References KisRotationOption::applyFanCornersInfo(), KisDabCacheUtils::DabRenderingResources::brush, KisPaintDevice::compositionSourceColorSpace(), KisSharedPtr< T >::data(), KisPainter::device, KisPrecisionOption::hasImprecisePositionOptions(), KisAirbrushOptionData::isChecked, KisCurveOption::isChecked(), m_airbrushData, KisBrushBasedPaintOp::m_brush, m_dabExecutor, KisBrushBasedPaintOp::m_mirrorOption, KisBrushBasedPaintOp::m_precisionOption, m_rotationOption, m_scatterOption, KisPaintOp::painter, KisAirbrushOptionData::read(), KisPainter::runnableStrokeJobsInterface, and KisPrecisionOption::setHasImprecisePositionOptions().
|
override |
Definition at line 99 of file kis_brushop.cpp.
|
protected |
Some KisRenderedDab may share their devices, so we should mirror them carefully, avoiding doing that twice. KisDabRenderingQueue is implemented in a way that duplicated dabs can go only sequentially, one after another, so we don't have to use complex deduplication algorithms here.
Definition at line 166 of file kis_brushop.cpp.
References KritaUtils::addJobConcurrent(), KritaUtils::addJobSequential(), and KisPaintOp::dab.
|
overridevirtual |
If the preset supports asynchronous updates, then the stroke execution core will call this method with a desired frame rate. The jobs that should be run to prepare the update are returned via jobs
In WA mode we do two things:
1) We ensure that the parallel threads do not access the same are on the image. For normal updates that is ensured by the code in KisImage and the scheduler. Here we should do that manually by adjusting 'rects' so that they would not intersect in the wrapped space.
2) We duplicate dabs, to ensure that all the pieces of dabs are painted inside the wrapped rect. No pieces are dabs are painted twice, because we paint only the parts intersecting the wrap rect.
After the dab has been rendered once, we should mirror it either one (h or v) or three (h and v) times. This sequence of 'if's achieves the goal without any extra copying. Please note that it has no 'else' branches, which is done intentionally!
NOTE: using currentUpdateTimePerDab in the calculation for the next update time instead of the average one makes rendering speed about 40% faster. It happens because the adaptation period is shorter than if it used
Reimplemented from KisPaintOp.
Definition at line 207 of file kis_brushop.cpp.
References KritaUtils::addJobConcurrent(), KritaUtils::addJobSequential(), addMirroringJobs(), KisWrappedRect::clipToWrapRect(), KisPaintOp::dab, KisPaintDevice::defaultBounds(), KisPainter::device, KisDefaultBoundsBase::imageBorderRect(), KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, m_avgNumDabs, m_avgSpacing, m_avgUpdateTimePerDab, m_currentUpdatePeriod, m_dabExecutor, m_idealNumRects, m_maxUpdatePeriod, m_minUpdatePeriod, m_updateSharedState, KisWrappedRect::normalizationOriginsForRect(), KisRenderedDab::offset, KisPaintOp::painter, KisRenderedDab::realBounds(), KisRollingMeanAccumulatorWrapper::rollingMean(), KisRollingMeanAccumulatorWrapper::rollingMeanSafe(), KisPaintOpUtils::splitDabsIntoRects(), toQShared(), and KisDefaultBoundsBase::wrapAroundModeAxis().
|
overrideprotectedvirtual |
The implementation of painting of a dab and updating spacing. This does NOT need to update the timing information.
Implements KisPaintOp.
Definition at line 103 of file kis_brushop.cpp.
References KisRotationOption::apply(), KisStandardOption< Data >::apply(), KisScatterOption::apply(), KisFlowOpacityOption2::apply(), KisBrushBasedPaintOp::checkSizeTooSmall(), KisBrushBasedPaintOp::effectiveSpacing(), KisLodTransformBase::lodToScale(), m_airbrushData, m_avgSpacing, KisBrushBasedPaintOp::m_brush, m_dabExecutor, m_lightnessStrengthOption, m_opacityOption, m_ratioOption, m_rotationOption, m_scatterOption, m_sizeOption, m_softnessOption, m_spacingOption, OPACITY_OPAQUE_F, KisPaintOp::painter, and KisSpacingInformation::scalarApprox().
|
overridevirtual |
Draw a line between pos1 and pos2 using the currently set brush and color. If savedDist is less than zero, the brush is painted at pos1 before being painted along the line using the spacing setting.
Reimplemented from KisPaintOp.
Definition at line 384 of file kis_brushop.cpp.
References KisPainter::bitBlt(), KisPaintDevice::clear(), KisPaintDevice::createCompositionSourceDevice(), KisPaintDevice::extent(), KisCurveOption::isChecked(), KisBrushBasedPaintOp::m_brush, m_lineCacheDevice, m_sharpnessOption, p, KisPaintOp::painter, KisPaintOp::paintLine(), KisPaintInformation::pos(), KisPainter::renderMirrorMask(), and KisPaintOp::source().
|
overrideprotectedvirtual |
Implementation of a spacing update
Implements KisPaintOp.
Definition at line 372 of file kis_brushop.cpp.
References KisRotationOption::apply(), KisStandardOption< Data >::apply(), KisBrushBasedPaintOp::effectiveSpacing(), KisLodTransformBase::lodToScale(), m_airbrushData, m_rotationOption, m_sizeOption, m_spacingOption, and KisPaintOp::painter.
|
overrideprotectedvirtual |
Implementation of a timing update. The default implementation always disables timing. This is suitable for paintops that do not support airbrushing.
Reimplemented from KisPaintOp.
Definition at line 379 of file kis_brushop.cpp.
References KisPaintOpPluginUtils::effectiveTiming(), m_airbrushData, and m_rateOption.
|
private |
Definition at line 64 of file kis_brushop.h.
|
private |
Definition at line 83 of file kis_brushop.h.
|
private |
Definition at line 82 of file kis_brushop.h.
|
private |
Definition at line 84 of file kis_brushop.h.
|
private |
Definition at line 81 of file kis_brushop.h.
|
private |
Definition at line 80 of file kis_brushop.h.
|
private |
Definition at line 86 of file kis_brushop.h.
|
private |
Definition at line 70 of file kis_brushop.h.
|
private |
Definition at line 78 of file kis_brushop.h.
|
private |
Definition at line 89 of file kis_brushop.h.
|
private |
Definition at line 88 of file kis_brushop.h.
|
private |
Definition at line 75 of file kis_brushop.h.
|
private |
Definition at line 68 of file kis_brushop.h.
|
private |
Definition at line 67 of file kis_brushop.h.
|
private |
Definition at line 74 of file kis_brushop.h.
|
private |
Definition at line 72 of file kis_brushop.h.
|
private |
Definition at line 73 of file kis_brushop.h.
|
private |
Definition at line 66 of file kis_brushop.h.
|
private |
Definition at line 69 of file kis_brushop.h.
|
private |
Definition at line 71 of file kis_brushop.h.
|
protected |
Definition at line 60 of file kis_brushop.h.