diff options
Diffstat (limited to 'UVtools.Core/Operations/OperationMask.cs')
-rw-r--r-- | UVtools.Core/Operations/OperationMask.cs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/UVtools.Core/Operations/OperationMask.cs b/UVtools.Core/Operations/OperationMask.cs index 972157f..3309e2f 100644 --- a/UVtools.Core/Operations/OperationMask.cs +++ b/UVtools.Core/Operations/OperationMask.cs @@ -57,6 +57,14 @@ namespace UVtools.Core.Operations public bool HaveMask => !(Mask is null); #endregion + #region Constructor + + public OperationMask() { } + + public OperationMask(FileFormat slicerFile) : base(slicerFile) { } + + #endregion + #region Methods public void InvertMask() @@ -65,25 +73,21 @@ namespace UVtools.Core.Operations CvInvoke.BitwiseNot(Mask, Mask); } - public override bool Execute(FileFormat slicerFile, OperationProgress progress = null) + protected override bool ExecuteInternally(OperationProgress progress) { - progress ??= new OperationProgress(); - progress.Reset(ProgressAction, LayerRangeCount); - Parallel.For(LayerIndexStart, LayerIndexEnd + 1, layerIndex => { if (progress.Token.IsCancellationRequested) return; - using var mat = slicerFile[layerIndex].LayerMat; + using var mat = SlicerFile[layerIndex].LayerMat; Execute(mat); - slicerFile[layerIndex].LayerMat = mat; + SlicerFile[layerIndex].LayerMat = mat; lock (progress.Mutex) { progress++; } }); - progress.Token.ThrowIfCancellationRequested(); - return true; + return !progress.Token.IsCancellationRequested; } public override bool Execute(Mat mat, params object[] arguments) |