diff options
Diffstat (limited to 'UVtools.Core/Operations/OperationBlur.cs')
-rw-r--r-- | UVtools.Core/Operations/OperationBlur.cs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/UVtools.Core/Operations/OperationBlur.cs b/UVtools.Core/Operations/OperationBlur.cs index a5237e6..bc9b456 100644 --- a/UVtools.Core/Operations/OperationBlur.cs +++ b/UVtools.Core/Operations/OperationBlur.cs @@ -124,28 +124,33 @@ namespace UVtools.Core.Operations #endregion + #region Constructor + + public OperationBlur() { } + + public OperationBlur(FileFormat slicerFile) : base(slicerFile) { } + + #endregion + #region Methods - public override bool Execute(FileFormat slicerFile, OperationProgress progress = null) - { - progress ??= new OperationProgress(); - progress.Reset(ProgressAction, LayerRangeCount); + protected override bool ExecuteInternally(OperationProgress progress) + { 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) |