Explorar o código

Improved direction calculation and texture op dispose

Krzysztof Krysiński hai 2 semanas
pai
achega
1350054bee

+ 3 - 1
src/ChunkyImageLib/Operations/TextureOperation.cs

@@ -1,5 +1,6 @@
 using ChunkyImageLib.DataHolders;
 using Drawie.Backend.Core;
+using Drawie.Backend.Core.ColorsImpl;
 using Drawie.Backend.Core.Numerics;
 using Drawie.Backend.Core.Surfaces.PaintImpl;
 using Drawie.Numerics;
@@ -89,7 +90,8 @@ internal class TextureOperation : IMirroredDrawOperation
 
         targetChunk.Surface.DrawingSurface.Canvas.Save();
         targetChunk.Surface.DrawingSurface.Canvas.SetMatrix(finalMatrix);
-        targetChunk.Surface.DrawingSurface.Canvas.DrawImage(toPaint.DrawingSurface.Snapshot(), 0, 0, customPaint);
+        using var snap = toPaint.DrawingSurface.Snapshot();
+        targetChunk.Surface.DrawingSurface.Canvas.DrawImage(snap, 0, 0, customPaint);
         targetChunk.Surface.DrawingSurface.Canvas.Restore();
     }
 

+ 4 - 0
src/PixiEditor.ChangeableDocument/Changeables/Brushes/BrushEngine.cs

@@ -29,6 +29,10 @@ internal class BrushEngine
         ColorSpace colorSpace, SamplingOptions samplingOptions,
         PointerInfo pointerInfo, EditorData editorData)
     {
+        if (brushData.BrushGraph == null)
+        {
+            return;
+        }
         var brushNode = brushData.BrushGraph.AllNodes.FirstOrDefault(x => x is BrushOutputNode) as BrushOutputNode;
         if (brushNode == null)
         {

+ 1 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/Matrix/Matrix3X3BaseNode.cs

@@ -27,7 +27,7 @@ public abstract class Matrix3X3BaseNode : RenderNode, IRenderInput
         Matrix = CreateFuncOutput<Float3x3>("Matrix", "OUTPUT_MATRIX",
             (c) => CalculateMatrix(c, c.GetValue(Input)));
 
-        OutputVector = CreateOutput<ShapeVectorData>("OutputVector", "OUTPUT_VECTOR", null);
+        OutputVector = CreateOutput<ShapeVectorData>("OutputVector", "VECTOR", null);
         Output.FirstInChain = null;
         AllowHighDpiRendering = true;
     }

+ 6 - 1
src/PixiEditor/Data/Localization/Languages/en.json

@@ -1127,5 +1127,10 @@
   "SECONDARY_COLOR": "Secondary Color",
   "STROKE_INFO_NODE": "Stroke Info",
   "SPACING": "Spacing",
-  "EDITOR_INFO_NODE": "Editor Info"
+  "EDITOR_INFO_NODE": "Editor Info",
+  "POSITION_ON_CANVAS": "Position on Canvas",
+  "MOVEMENT_DIRECTION": "Movement Direction",
+  "TWIST": "Twist",
+    "TILT": "Tilt",
+  "POINTER_INFO_NODE": "Pointer Info"
 }

+ 1 - 1
src/PixiEditor/Models/DocumentModels/ChangeExecutionController.cs

@@ -341,7 +341,7 @@ internal class ChangeExecutionController
 
     private PointerInfo ConstructPointerInfo(VecD currentPoint, MouseOnCanvasEventArgs args)
     {
-        if (VecD.Distance(lastDirCalculationPoint, currentPoint) > 20)
+        if (VecD.Distance(lastDirCalculationPoint, currentPoint) > 1)
         {
             lastDirCalculationPoint = lastDirCalculationPoint.Lerp(currentPoint, 0.5f);
         }

+ 1 - 1
src/PixiEditor/Views/Rendering/Scene.cs

@@ -687,7 +687,7 @@ internal class Scene : Zoombox.Zoombox, ICustomHitTest
         var data = e.GetCurrentPoint(this);
         VecD lastPoint = new VecD(lastDirCalculationPoint.X, lastDirCalculationPoint.Y);
         VecD currentPoint = new VecD(data.Position.X, data.Position.Y);
-        if (VecD.Distance(lastPoint, currentPoint) > 20)
+        if (VecD.Distance(lastPoint, currentPoint) > 1)
         {
             lastDirCalculationPoint = Lerp(lastPoint, currentPoint, 0.5f);
         }