Parcourir la source

Fixed chunk rendering for outline

Krzysztof Krysiński il y a 1 mois
Parent
commit
c0e645ade6

+ 10 - 2
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/Effects/OutlineNode.cs

@@ -86,11 +86,19 @@ public class OutlineNode : RenderNode, IRenderInput
             using Texture temp = Texture.ForProcessing(surface, context.ProcessingColorSpace);
             int saved = temp.DrawingSurface.Canvas.SaveLayer(paint);
 
-            Background.Value.Paint(context, temp.DrawingSurface);
+            var ctx = context.Clone();
+            ctx.ChunkResolution = ChunkResolution.Full;
+            ctx.RenderOutputSize = (VecI)(context.RenderOutputSize * context.ChunkResolution.InvertedMultiplier());
+
+            Background.Value.Paint(ctx, temp.DrawingSurface);
 
             temp.DrawingSurface.Canvas.RestoreToCount(saved);
 
-            for (int i = 1; i < (int)Thickness.Value; i++)
+            temp.DrawingSurface.Canvas.SetMatrix(Matrix3X3.Identity);
+
+            int thickness = (int)(Thickness.Value * context.ChunkResolution.Multiplier());
+
+            for (int i = 1; i < (int)thickness; i++)
             {
                 saved = temp.DrawingSurface.Canvas.SaveLayer(paint);
 

+ 10 - 1
src/PixiEditor.ChangeableDocument/Rendering/RenderContext.cs

@@ -12,7 +12,7 @@ public class RenderContext
     public double Opacity { get; set; }
 
     public KeyFrameTime FrameTime { get; }
-    public ChunkResolution ChunkResolution { get; }
+    public ChunkResolution ChunkResolution { get; set; }
     public VecI RenderOutputSize { get; set; }
 
     public VecI DocumentSize { get; set; }
@@ -60,4 +60,13 @@ public class RenderContext
             _ => DrawingApiBlendMode.SrcOver,
         };
     }
+
+    public RenderContext Clone()
+    {
+        return new RenderContext(RenderSurface, FrameTime, ChunkResolution, RenderOutputSize, DocumentSize, ProcessingColorSpace, Opacity)
+        {
+            FullRerender = FullRerender,
+            TargetOutput = TargetOutput
+        };
+    }
 }