|
Krita Source Code Documentation
|
#include <inplace_transform_stroke_strategy.h>
Inheritance diagram for InplaceTransformStrokeStrategy:Classes | |
| struct | BarrierUpdateData |
| class | CalculateConvexHullData |
| struct | Private |
| class | UpdateTransformData |
Public Types | |
| enum | CommandGroup { Clear = 0 , ClearTemporary , Transform , TransformTemporary , TransformLod , TransformLodTemporary } |
Public Types inherited from KisSimpleStrokeStrategy | |
| enum | JobType { JOB_INIT = 0 , JOB_CANCEL , JOB_FINISH , JOB_DOSTROKE , JOB_SUSPEND , JOB_RESUME , NJOBS } |
Signals | |
| void | sigConvexHullCalculated (QPolygon convexHull, void *cookie) |
| void | sigTransactionGenerated (TransformTransactionProperties transaction, ToolTransformArgs args, void *cookie) |
Static Private Member Functions | |
| static void | repopulateUI (QVector< KisStrokeJobData * > &mutatedJobs, KisUpdatesFacade *updatesFacade, const QRect &dirtyRect) |
Private Attributes | |
| const QScopedPointer< Private > | m_d |
Friends | |
| class | InitializeTransformModeStrokeStrategy |
Additional Inherited Members | |
Static Public Member Functions inherited from KisSimpleStrokeStrategy | |
| static QLatin1String | jobTypeToString (JobType type) |
Definition at line 28 of file inplace_transform_stroke_strategy.h.
The transformation pipeline usually looks like that:
1) Apply Clear commands for all the layers. Some clear commands might be "temporary", that is, they do not go to the final history, e.g. when clearing a shape layer's projection.
2) Apply TransformLod commands to generate preview of the transformation. Some commands may be declared as "temporary", that is, they do not go to the final history, e.g. for the shape layer, for which we just write to the projection device explicitly.
3) When transformation is changed we undo all TransformLod and TransformTemporary commands to recover the old state. The temporary command recovers the state of shape layers' projection device.
4) Repeat steps 2) and 3) until the user is satisfied.
5) When "Apply" button is pressed, all transform commands are undone like in step 2).
6) All Transform commands are applied at Lod0-level. TransformTemporary is not used atm.
7) All non-temporary commands go to the undo history.
| Enumerator | |
|---|---|
| Clear | |
| ClearTemporary | |
| Transform | |
| TransformTemporary | |
| TransformLod | |
| TransformLodTemporary | |
Definition at line 114 of file inplace_transform_stroke_strategy.h.
| InplaceTransformStrokeStrategy::InplaceTransformStrokeStrategy | ( | ToolTransformArgs::TransformMode | mode, |
| const QString & | filterId, | ||
| bool | forceReset, | ||
| KisNodeList | rootNodes, | ||
| KisSelectionSP | selection, | ||
| KisPaintDeviceSP | externalSource, | ||
| KisStrokeUndoFacade * | undoFacade, | ||
| KisUpdatesFacade * | updatesFacade, | ||
| KisNodeSP | imageRoot, | ||
| bool | forceLodMode ) |
Definition at line 143 of file inplace_transform_stroke_strategy.cpp.
References KisSharedPtr< T >::data(), KIS_SAFE_ASSERT_RECOVER_NOOP, m_d, KisStrokeStrategyUndoCommandBased::setMacroId(), KisStrokeStrategy::setNeedsExplicitCancel(), KisCommandUtils::TransformToolId, and KisStrokeStrategyUndoCommandBased::undoFacade().
|
override |
Definition at line 180 of file inplace_transform_stroke_strategy.cpp.
|
private |
|
private |
Definition at line 1228 of file inplace_transform_stroke_strategy.cpp.
References m_d.
|
private |
Definition at line 300 of file inplace_transform_stroke_strategy.cpp.
References AlphaColorModelID, KoColorSpace::colorModelId(), KisPaintDevice::colorSpace(), KisPaintDevice::compositionSourceColorSpace(), KisSharedPtr< T >::data(), ENTER_FUNCTION, KisConvexHull::findConvexHull(), KisConvexHull::findConvexHullSelectionLike(), m_d, KisBaseNode::paintDevice(), and ppVar.
|
private |
Definition at line 270 of file inplace_transform_stroke_strategy.cpp.
References KisStrokeStrategy::currentLodPreferences(), KisLodPreferences::desiredLevelOfDetail(), KisLodPreferences::lodPreferred(), KisLodPreferences::lodSupported(), m_d, and KisAlgebra2D::maxDimension().
|
private |
It is too late to cancel anything, the transformation has been completed and its commands have been pushed into the undo adapter, so there is no way to stop that.
We could have issues updates on lodN planes, which did not end up in the final lod0 update, so we should reupload lod0 data to the UI part manually.
We could have issues updates on lodN planes, which did not end up in the final lod0 update, so we should reupload lod0 data to the UI part manually.
Definition at line 1133 of file inplace_transform_stroke_strategy.cpp.
References KritaUtils::addJobBarrier(), KritaUtils::addJobSequential(), KisStrokeStrategyUndoCommandBased::cancelStrokeCallback(), finalizeStrokeImpl(), KisStrokeStrategyUndoCommandBased::finishStrokeCallback(), KIS_SAFE_ASSERT_RECOVER_NOOP, m_d, KisTransformMask::overrideStaticCacheDevice(), reapplyTransform(), repopulateUI(), InplaceTransformStrokeStrategy::UpdateTransformData::SELECTION, KisTransformMask::threadSafeForceStaticImageUpdate(), undoAllCommands(), and undoTransformCommands().
|
overridevirtual |
Reimplemented from KisSimpleStrokeStrategy.
Definition at line 662 of file inplace_transform_stroke_strategy.cpp.
References KisStrokeStrategy::addMutatedJobs(), and cancelAction().
Definition at line 873 of file inplace_transform_stroke_strategy.cpp.
References KisPainter::bitBlt(), KisPaintDevice::clear(), Clear, KisPaintDevice::clearSelection(), ClearTemporary, KisStrokeJobData::CONCURRENT, KisPaintDevice::createCompositionSourceDevice(), KisSharedPtr< T >::data(), KisTransaction::endAndTake(), executeAndAddCommand(), KisPaintDevice::extent(), ToolTransformArgs::FREE_TRANSFORM, KIS_SAFE_ASSERT_RECOVER_NOOP, m_d, KisBaseNode::paintDevice(), ToolTransformArgs::PERSPECTIVE_4POINT, KisBaseNode::projection(), KisPaintDevice::setDirty(), and KisPainter::setSelection().
|
private |
Definition at line 242 of file inplace_transform_stroke_strategy.cpp.
References KritaUtils::addJobBarrier(), KisStrokeStrategy::addMutatedJobs(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_d, and reapplyTransform().
|
overridevirtual |
Reimplemented from KisSimpleStrokeStrategy.
Definition at line 184 of file inplace_transform_stroke_strategy.cpp.
References calculateConvexHull(), KisStrokeJobData::CONCURRENT, doCanvasUpdate(), KisStrokeStrategyUndoCommandBased::doStrokeCallback(), KisTransaction::endAndTake(), m_d, KisStrokeJobData::NORMAL, InplaceTransformStrokeStrategy::UpdateTransformData::PAINT_DEVICE, KisStrokeStrategyUndoCommandBased::runAndSaveCommand(), sigConvexHullCalculated(), KisTransformUtils::transformDevice(), and tryPostUpdateJob().
|
private |
Definition at line 688 of file inplace_transform_stroke_strategy.cpp.
References KisStrokeStrategyUndoCommandBased::executeCommand(), m_d, and toQShared().
|
private |
Definition at line 743 of file inplace_transform_stroke_strategy.cpp.
References m_d, and KisLodTransformBase::upscaledRect().
|
private |
Definition at line 1015 of file inplace_transform_stroke_strategy.cpp.
References KritaUtils::addJobBarrier(), m_d, notifyAllCommandsDone(), KisMask::selection, KisSelectionMask::setDirty(), and KisSelection::setVisible().
|
private |
Update jobs from level of detail updates may cause dirtying of the transform mask's static cache device. Therefore we must ensure that final update of the mask happens strictly after them.
Transform masks don't have internal state switch for LoD mode, therefore all the preview transformations must be cancelled before applying the final command
We could have issues updates on lodN planes, which did not end up in the final lod0 update, so we should reupload lod0 data to the UI part manually.
Definition at line 1052 of file inplace_transform_stroke_strategy.cpp.
References KritaUtils::addJobBarrier(), KritaUtils::addJobSequential(), KisStrokeStrategy::addMutatedJobs(), cancelAction(), finalizeStrokeImpl(), KisStrokeStrategyUndoCommandBased::finishStrokeCallback(), m_d, KisTransformMask::overrideStaticCacheDevice(), reapplyTransform(), repopulateUI(), InplaceTransformStrokeStrategy::UpdateTransformData::SELECTION, and undoTransformCommands().
|
overridevirtual |
Reimplemented from KisSimpleStrokeStrategy.
Definition at line 651 of file inplace_transform_stroke_strategy.cpp.
References KisStrokeStrategy::addMutatedJobs(), and finishAction().
|
overridevirtual |
In case we are doing a continued action, we need to set initial update to the "very initial" state that was present before the previous stroke. So here we just override the rect calculated before
We need to make sure that the nodes will be successfully be transformed back in case the stroke will be finished before sigTransactionGenerated() signal is delivered.
We must request shape layers to rerender areas outside image bounds
We must ensure that the currently selected subtree has finished all its updates.
Disable all decorated nodes to generate outline and preview correctly. We will enable them back as soon as preview generation is finished.
Filter masks have special handling of transparency. Their filter may declare if they affect transparent pixels or not. In case of transformations we don't care about that, we should just transform non-default area of the mask.
We shouldn't include masks or layer styles into the handles rect, in the end, we process the paint device only
recover back visibility of decorated nodes
Reimplemented from KisSimpleStrokeStrategy.
Definition at line 374 of file inplace_transform_stroke_strategy.cpp.
References KisAutoKey::activeMode(), KritaUtils::addJobBarrier(), KritaUtils::addJobSequential(), KisStrokeStrategy::addMutatedJobs(), KisBatchNodeUpdate::addUpdate(), KisStrokeJobData::BARRIER, ToolTransformArgs::boundsRotation(), calculateConvexHull(), calculatePreferredLevelOfDetail(), KisSharedPtr< T >::clear(), Clear, KisBatchNodeUpdate::compressed(), createCacheAndClearNode(), TransformTransactionProperties::currentConfig(), KisSharedPtr< T >::data(), KisDecoratedNodeInterface::decorationsVisible(), KisBaseNode::exactBounds(), KisPaintDevice::exactBounds(), executeAndAddCommand(), KisTransformUtils::fetchCurrentImageTime(), KisTransformUtils::fetchNodesList(), KisCommandUtils::FlipFlopCommand::FINALIZING, KisLayerUtils::forceAllDelayedNodesUpdate(), KisLayerUtils::forceAllHiddenOriginalsUpdate(), KisNode::graphListener, KisNodeGraphListener::graphOverlayNode(), KisBaseNode::hasEditablePaintDevice(), KisCommandUtils::FlipFlopCommand::INITIALIZING, KisStrokeStrategyUndoCommandBased::initStrokeCallback(), KIS_SAFE_ASSERT_RECOVER_NOOP, m_d, KisLodTransform::map(), KisLazyCreateTransformMaskKeyframesCommand::maskHasAnimation(), KisAutoKey::NONE, KisStrokeJobData::NORMAL, KisBaseNode::paintDevice(), KisNode::projectionLeaf, KisNode::projectionPlane(), KisTransformUtils::resetArgsForMode(), KisStrokeStrategyUndoCommandBased::runAndSaveCommand(), TransformTransactionProperties::setConvexHull(), TransformTransactionProperties::setConvexHullHasBeenRequested(), KisSelectionMask::setDecorationsVisible(), KisDecoratedNodeInterface::setDecorationsVisible(), sigTransactionGenerated(), KisAutoKey::SupportsLod, toQShared(), KisAutoKey::tryAutoCreateDuplicatedFrame(), KisTransformUtils::tryFetchArgsFromCommandAndUndo(), KisTransformUtils::tryInitArgsFromNode(), and KisTransformUtils::tryOverrideRootToTransformMask().
|
private |
Definition at line 696 of file inplace_transform_stroke_strategy.cpp.
References Clear, m_d, KisStrokeJobData::NORMAL, KisStrokeStrategyUndoCommandBased::notifyCommandDone(), KisStrokeJobData::SEQUENTIAL, toQShared(), and Transform.
|
overrideprotectedvirtual |
Applies some modifications (e.g. assigning extra data) to the toplevel command.
Reimplemented from KisStrokeStrategyUndoCommandBased.
Definition at line 288 of file inplace_transform_stroke_strategy.cpp.
References m_d, KisStrokeStrategyUndoCommandBased::postProcessToplevelCommand(), and KisTransformUtils::postProcessToplevelCommand().
| InplaceTransformStrokeStrategy::Q_ENUM | ( | CommandGroup | ) |
|
private |
We also Q_EMIT the updates manually, because KisUpdateCommandEx is still blocked by m_d->commandUpdatesBlockerCookie (for easy undo purposes)
Definition at line 948 of file inplace_transform_stroke_strategy.cpp.
References KritaUtils::addJobBarrier(), KritaUtils::addJobConcurrent(), KisStrokeJobData::BARRIER, executeAndAddCommand(), fetchAllUpdateRequests(), KisCommandUtils::FlipFlopCommand::FINALIZING, KisCommandUtils::FlipFlopCommand::INITIALIZING, KisLodTransformBase::lodToScale(), m_d, ToolTransformArgs::scale3dSrcAndDst(), KisTransformMask::threadSafeForceStaticImageUpdate(), Transform, TransformLod, transformNode(), and undoTransformCommands().
|
staticprivate |
Definition at line 1039 of file inplace_transform_stroke_strategy.cpp.
References KritaUtils::addJobConcurrent(), KisUpdatesFacade::notifyUIUpdateCompleted(), KritaUtils::optimalPatchSize(), and KritaUtils::splitRectIntoPatchesTight().
|
signal |
|
signal |
|
private |
we should make sure that the asynchronous shape regeneration has completed before we issue the updates a bit later
Shape layer's projection may not be yet ready right after transformation, because it need to do that in the GUI thread, so we should approximate that.
Definition at line 764 of file inplace_transform_stroke_strategy.cpp.
References addDirtyRect(), KisPaintDevice::colorSpace(), KisStrokeJobData::CONCURRENT, KisTransformUtils::createTransformWorker(), KisSharedPtr< T >::data(), KisTransaction::endAndTake(), executeAndAddCommand(), KisPaintDevice::extent(), ToolTransformArgs::FREE_TRANSFORM, KIS_SAFE_ASSERT_RECOVER_RETURN, kisGrowRect(), m_d, ToolTransformArgs::mode(), KisBaseNode::paintDevice(), ToolTransformArgs::PERSPECTIVE_4POINT, KisPaintDevice::prepareClone(), KisBaseNode::projection(), KisNode::projectionPlane(), Transform, KisTransformUtils::transformAndMergeDevice(), TransformLod, and TransformLodTemporary.
|
private |
Definition at line 230 of file inplace_transform_stroke_strategy.cpp.
References KisStrokeStrategy::addMutatedJob(), and m_d.
|
private |
Definition at line 713 of file inplace_transform_stroke_strategy.cpp.
References KisStrokeStrategyUndoCommandBased::executeCommand(), and m_d.
|
private |
Definition at line 725 of file inplace_transform_stroke_strategy.cpp.
References KisStrokeStrategyUndoCommandBased::executeCommand(), m_d, Transform, TransformLod, TransformLodTemporary, and TransformTemporary.
|
friend |
Definition at line 149 of file inplace_transform_stroke_strategy.h.
|
private |
Definition at line 180 of file inplace_transform_stroke_strategy.h.