Browse Source

Fixed layer stored in ram

Krzysztof Krysiński 2 years ago
parent
commit
cd1485976a

+ 3 - 7
src/PixiEditor.ChangeableDocument/Changes/Structure/ApplyMask_Change.cs

@@ -8,8 +8,7 @@ namespace PixiEditor.ChangeableDocument.Changes.Structure;
 internal sealed class ApplyMask_Change : Change
 internal sealed class ApplyMask_Change : Change
 {
 {
     private Guid structureMemberGuid;
     private Guid structureMemberGuid;
-    private Layer? layer;
-    
+
     private CommittedChunkStorage? savedChunks;
     private CommittedChunkStorage? savedChunks;
 
 
     [GenerateMakeChangeAction]
     [GenerateMakeChangeAction]
@@ -22,16 +21,13 @@ internal sealed class ApplyMask_Change : Change
     {
     {
         var member = target.FindMember(structureMemberGuid);
         var member = target.FindMember(structureMemberGuid);
         bool isValid = member is not (null or Folder) && member.Mask is not null;
         bool isValid = member is not (null or Folder) && member.Mask is not null;
-        if (isValid)
-        {
-            layer = member as Layer;
-        }
-        
+
         return isValid;
         return isValid;
     }
     }
 
 
     public override OneOf<None, IChangeInfo, List<IChangeInfo>> Apply(Document target, bool firstApply, out bool ignoreInUndo)
     public override OneOf<None, IChangeInfo, List<IChangeInfo>> Apply(Document target, bool firstApply, out bool ignoreInUndo)
     {
     {
+        var layer = (Layer)target.FindMember(structureMemberGuid)!;
         layer!.LayerImage.EnqueueApplyMask(layer.Mask!);
         layer!.LayerImage.EnqueueApplyMask(layer.Mask!);
         ignoreInUndo = false;
         ignoreInUndo = false;
         var layerInfo = new LayerImageChunks_ChangeInfo(structureMemberGuid, layer.LayerImage.FindAffectedChunks());
         var layerInfo = new LayerImageChunks_ChangeInfo(structureMemberGuid, layer.LayerImage.FindAffectedChunks());

+ 0 - 7
src/PixiEditor/Models/DocumentModels/Public/DocumentOperationsModule.cs

@@ -1,12 +1,7 @@
 using System.Collections.Immutable;
 using System.Collections.Immutable;
-using System.Windows.Interop;
-using System.Windows.Shapes;
 using ChunkyImageLib;
 using ChunkyImageLib;
 using ChunkyImageLib.DataHolders;
 using ChunkyImageLib.DataHolders;
-using ChunkyImageLib.Operations;
-using PixiEditor.ChangeableDocument.Actions.Generated;
 using PixiEditor.ChangeableDocument.Actions.Undo;
 using PixiEditor.ChangeableDocument.Actions.Undo;
-using PixiEditor.ChangeableDocument.ChangeInfos.Root.ReferenceLayerChangeInfos;
 using PixiEditor.ChangeableDocument.Enums;
 using PixiEditor.ChangeableDocument.Enums;
 using PixiEditor.DrawingApi.Core.ColorsImpl;
 using PixiEditor.DrawingApi.Core.ColorsImpl;
 using PixiEditor.DrawingApi.Core.Numerics;
 using PixiEditor.DrawingApi.Core.Numerics;
@@ -14,9 +9,7 @@ using PixiEditor.Models.DocumentModels.UpdateableChangeExecutors;
 using PixiEditor.Models.DocumentPassthroughActions;
 using PixiEditor.Models.DocumentPassthroughActions;
 using PixiEditor.Models.Enums;
 using PixiEditor.Models.Enums;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Position;
-using PixiEditor.Parser;
 using PixiEditor.ViewModels.SubViewModels.Document;
 using PixiEditor.ViewModels.SubViewModels.Document;
-using PixiEditor.Views.UserControls.Overlays.TransformOverlay;
 
 
 namespace PixiEditor.Models.DocumentModels.Public;
 namespace PixiEditor.Models.DocumentModels.Public;
 #nullable enable
 #nullable enable