|
@@ -12,6 +12,7 @@ using Drawie.Backend.Core.Surfaces.ImageData;
|
|
using Drawie.Backend.Core.Surfaces.PaintImpl;
|
|
using Drawie.Backend.Core.Surfaces.PaintImpl;
|
|
using Drawie.Backend.Core.Text;
|
|
using Drawie.Backend.Core.Text;
|
|
using Drawie.Numerics;
|
|
using Drawie.Numerics;
|
|
|
|
+using PixiEditor.ChangeableDocument.Changeables.Graph.Nodes.Workspace;
|
|
|
|
|
|
namespace PixiEditor.ChangeableDocument.Rendering;
|
|
namespace PixiEditor.ChangeableDocument.Rendering;
|
|
|
|
|
|
@@ -65,7 +66,7 @@ public class DocumentRenderer : IPreviewRenderable, IDisposable
|
|
toRenderOn.Canvas.Save();
|
|
toRenderOn.Canvas.Save();
|
|
toRenderOn.Canvas.SetMatrix(Matrix3X3.Identity);
|
|
toRenderOn.Canvas.SetMatrix(Matrix3X3.Identity);
|
|
|
|
|
|
- RenderContext context = new(renderTexture.DrawingSurface, frame, resolution, Document.Size,
|
|
|
|
|
|
+ RenderContext context = new(renderTexture.DrawingSurface, frame, resolution, Document.Size, Document.Size,
|
|
Document.ProcessingColorSpace);
|
|
Document.ProcessingColorSpace);
|
|
context.FullRerender = true;
|
|
context.FullRerender = true;
|
|
IReadOnlyNodeGraph membersOnlyGraph = ConstructMembersOnlyGraph(layersToCombine, Document.NodeGraph);
|
|
IReadOnlyNodeGraph membersOnlyGraph = ConstructMembersOnlyGraph(layersToCombine, Document.NodeGraph);
|
|
@@ -111,7 +112,7 @@ public class DocumentRenderer : IPreviewRenderable, IDisposable
|
|
toRenderOn.Canvas.Save();
|
|
toRenderOn.Canvas.Save();
|
|
toRenderOn.Canvas.SetMatrix(Matrix3X3.Identity);
|
|
toRenderOn.Canvas.SetMatrix(Matrix3X3.Identity);
|
|
|
|
|
|
- RenderContext context = new(renderTexture.DrawingSurface, frameTime, resolution, Document.Size,
|
|
|
|
|
|
+ RenderContext context = new(renderTexture.DrawingSurface, frameTime, resolution, Document.Size, Document.Size,
|
|
Document.ProcessingColorSpace);
|
|
Document.ProcessingColorSpace);
|
|
context.FullRerender = true;
|
|
context.FullRerender = true;
|
|
|
|
|
|
@@ -225,9 +226,6 @@ public class DocumentRenderer : IPreviewRenderable, IDisposable
|
|
toRenderOn.Canvas.Save();
|
|
toRenderOn.Canvas.Save();
|
|
toRenderOn.Canvas.SetMatrix(Matrix3X3.Identity);
|
|
toRenderOn.Canvas.SetMatrix(Matrix3X3.Identity);
|
|
|
|
|
|
- RenderContext context =
|
|
|
|
- new(renderTexture.DrawingSurface, frameTime, ChunkResolution.Full, Document.Size,
|
|
|
|
- Document.ProcessingColorSpace) { FullRerender = true };
|
|
|
|
|
|
|
|
bool hasCustomOutput = !string.IsNullOrEmpty(customOutput) && customOutput != "DEFAULT";
|
|
bool hasCustomOutput = !string.IsNullOrEmpty(customOutput) && customOutput != "DEFAULT";
|
|
|
|
|
|
@@ -235,6 +233,10 @@ public class DocumentRenderer : IPreviewRenderable, IDisposable
|
|
? RenderingUtils.SolveFinalNodeGraph(customOutput, Document)
|
|
? RenderingUtils.SolveFinalNodeGraph(customOutput, Document)
|
|
: Document.NodeGraph;
|
|
: Document.NodeGraph;
|
|
|
|
|
|
|
|
+ RenderContext context =
|
|
|
|
+ new(renderTexture.DrawingSurface, frameTime, ChunkResolution.Full, SolveRenderOutputSize(customOutput, graph, Document.Size),
|
|
|
|
+ Document.Size, Document.ProcessingColorSpace) { FullRerender = true };
|
|
|
|
+
|
|
if (hasCustomOutput)
|
|
if (hasCustomOutput)
|
|
{
|
|
{
|
|
context.TargetOutput = customOutput;
|
|
context.TargetOutput = customOutput;
|
|
@@ -334,6 +336,30 @@ public class DocumentRenderer : IPreviewRenderable, IDisposable
|
|
return found ?? (membersOnlyGraph.OutputNode as IRenderInput)?.Background;
|
|
return found ?? (membersOnlyGraph.OutputNode as IRenderInput)?.Background;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private static VecI SolveRenderOutputSize(string? targetOutput, IReadOnlyNodeGraph finalGraph, VecI documentSize)
|
|
|
|
+ {
|
|
|
|
+ VecI finalSize = documentSize;
|
|
|
|
+ if (targetOutput != null)
|
|
|
|
+ {
|
|
|
|
+ var outputNode = finalGraph.AllNodes.FirstOrDefault(n =>
|
|
|
|
+ n is CustomOutputNode outputNode && outputNode.OutputName.Value == targetOutput);
|
|
|
|
+
|
|
|
|
+ if (outputNode is CustomOutputNode customOutputNode)
|
|
|
|
+ {
|
|
|
|
+ if (customOutputNode.Size.Value.ShortestAxis > 0)
|
|
|
|
+ {
|
|
|
|
+ finalSize = customOutputNode.Size.Value;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ finalSize = documentSize;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return finalSize;
|
|
|
|
+ }
|
|
|
|
+
|
|
public void Dispose()
|
|
public void Dispose()
|
|
{
|
|
{
|
|
renderTexture?.Dispose();
|
|
renderTexture?.Dispose();
|