Forráskód Böngészése

fix deformation grid bug

Johann ELSASS 5 éve
szülő
commit
b96eae59ce
2 módosított fájl, 13 hozzáadás és 1 törlés
  1. 2 1
      lazpaint/tools/utool.pas
  2. 11 0
      lazpaint/tools/utooldeformationgrid.pas

+ 2 - 1
lazpaint/tools/utool.pas

@@ -3372,7 +3372,8 @@ begin
   begin
     FDeformationGridNbX := ASize.cx;
     FDeformationGridNbY := ASize.cy;
-    ToolUpdate;
+    if ToolUpdate then
+      Image.OnImageChanged.NotifyObservers;
     if Assigned(FOnDeformationGridChanged) then FOnDeformationGridChanged(self);
   end;
 end;

+ 11 - 0
lazpaint/tools/utooldeformationgrid.pas

@@ -35,6 +35,7 @@ type
     function GetIsSelectingTool: boolean; override;
     function DoToolUpdate({%H-}toolDest: TBGRABitmap): TRect; override;
   public
+    constructor Create(AManager: TToolManager); override;
     function ToolUp: TRect; override;
     function GetContextualToolbars: TContextualToolbars; override;
     function Render(VirtualScreen: TBGRABitmap; {%H-}VirtualScreenWidth, {%H-}VirtualScreenHeight: integer; BitmapToVirtualScreen: TBitmapToVirtualScreenFunction): TRect; override;
@@ -1130,12 +1131,22 @@ begin
     ReleaseGrid;
     DeformationGrid := nil;
     DeformationGridTexCoord := nil;
+    deformationGridNbX:= 0;
+    deformationGridNbY:= 0;
     Result:= OnlyRenderChange;
   end
   else
     result := EmptyRect;
 end;
 
+constructor TToolDeformationGrid.Create(AManager: TToolManager);
+begin
+  inherited Create(AManager);
+  deformationGridNbX:= 0;
+  deformationGridNbY:= 0;
+  DoingDeformation:= false;
+end;
+
 function TToolDeformationGrid.Render(VirtualScreen: TBGRABitmap;
   VirtualScreenWidth, VirtualScreenHeight: integer; BitmapToVirtualScreen: TBitmapToVirtualScreenFunction): TRect;
 var curPt,rightPt,downPt: TPointF;