Pārlūkot izejas kodu

use original when duplicating

Unknown 6 gadi atpakaļ
vecāks
revīzija
c3bd0eae89
2 mainītis faili ar 12 papildinājumiem un 3 dzēšanām
  1. 11 2
      lazpaint/uimagediff.pas
  2. 1 1
      lazpaint/uimagestate.pas

+ 11 - 2
lazpaint/uimagediff.pas

@@ -327,9 +327,10 @@ type
   public
     sourceLayerId: integer;
     duplicateId: integer;
+    useOriginal: boolean;
     procedure ApplyTo(AState: TState); override;
     procedure UnapplyTo(AState: TState); override;
-    constructor Create(ADestination: TState);
+    constructor Create(ADestination: TState; AUseOriginal: boolean);
   end;
 
   { TMoveLayerStateDifference }
@@ -1551,6 +1552,12 @@ begin
       LayerName[copy] := LayerName[sourceLayerIndex];
       LayerOffset[copy] := LayerOffset[sourceLayerIndex];
       LayerVisible[copy] := LayerVisible[sourceLayerIndex];
+      if useOriginal then
+      begin
+        LayerOriginalGuid[copy] := LayerOriginalGuid[sourceLayerIndex];
+        LayerOriginalMatrix[copy] := LayerOriginalMatrix[sourceLayerIndex];
+        LayerOriginalRenderStatus[copy] := LayerOriginalRenderStatus[sourceLayerIndex];
+      end;
       LayerUniqueId[copy] := duplicateId;
       InsertLayer(duplicateIndex, copy);
     end;
@@ -1571,11 +1578,13 @@ begin
   end;
 end;
 
-constructor TDuplicateLayerStateDifference.Create(ADestination: TState);
+constructor TDuplicateLayerStateDifference.Create(ADestination: TState;
+  AUseOriginal: boolean);
 var imgDest: TImageState;
 begin
   inherited Create(ADestination);
   imgDest := ADestination as TImageState;
+  useOriginal:= AUseOriginal;
   with imgDest do
   begin
     self.sourceLayerId := LayeredBitmap.LayerUniqueId[SelectedImageLayerIndex];

+ 1 - 1
lazpaint/uimagestate.pas

@@ -776,7 +776,7 @@ begin
   if LayeredBitmap = nil then
     result := nil
   else
-    result := TDuplicateLayerStateDifference.Create(self);
+    result := TDuplicateLayerStateDifference.Create(self, true);
 end;
 
 function TImageState.MergerLayerOver(ALayerOverIndex: integer): TCustomImageDifference;