소스 검색

Fixed custom output render in forced low dpi

Krzysztof Krysiński 3 달 전
부모
커밋
5b4e799094

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

@@ -1046,5 +1046,5 @@
   "IS_DEFAULT_EXPORT": "Is Default Export",
   "EXPORT_OUTPUT": "Export Output",
   "RENDER_OUTPUT_SIZE": "Render Output Size",
-  "RENDER_OUTPUT_CENTER": "Render Output Center",
+  "RENDER_OUTPUT_CENTER": "Render Output Center"
 }

+ 6 - 6
src/PixiEditor/Models/Rendering/SceneRenderer.cs

@@ -74,9 +74,10 @@ internal class SceneRenderer : IDisposable
         Texture? renderTexture = null;
         bool restoreCanvas = false;
 
-        if (RenderInDocumentSize())
+        VecI finalSize = SolveRenderOutputSize(targetOutput, finalGraph, Document.Size);
+        if (RenderInOutputSize(finalGraph))
         {
-            renderTexture = Texture.ForProcessing(Document.Size, Document.ProcessingColorSpace);
+            renderTexture = Texture.ForProcessing(finalSize, Document.ProcessingColorSpace);
             renderTarget = renderTexture.DrawingSurface;
         }
         else
@@ -93,7 +94,6 @@ internal class SceneRenderer : IDisposable
             restoreCanvas = true;
         }
 
-        VecI finalSize = SolveRenderOutputSize(targetOutput, finalGraph, Document.Size);
         RenderContext context = new(renderTarget, DocumentViewModel.AnimationHandler.ActiveFrameTime,
             resolution, finalSize, Document.Size, Document.ProcessingColorSpace);
         context.TargetOutput = targetOutput;
@@ -136,9 +136,9 @@ internal class SceneRenderer : IDisposable
         return finalSize;
     }
 
-    private bool RenderInDocumentSize()
+    private bool RenderInOutputSize(IReadOnlyNodeGraph finalGraph)
     {
-        return !HighResRendering || !HighDpiRenderNodePresent(Document.NodeGraph);
+        return !HighResRendering || !HighDpiRenderNodePresent(finalGraph);
     }
 
     private bool ShouldRerender(DrawingSurface target, ChunkResolution resolution, string? targetOutput,
@@ -162,7 +162,7 @@ internal class SceneRenderer : IDisposable
             return true;
         }
 
-        bool renderInDocumentSize = RenderInDocumentSize();
+        bool renderInDocumentSize = RenderInOutputSize(finalGraph);
         VecI compareSize = renderInDocumentSize ? Document.Size : target.DeviceClipBounds.Size;
 
         if (cachedTexture.DrawingSurface.DeviceClipBounds.Size != compareSize)

+ 3 - 5
src/PixiEditor/ViewModels/Document/NodeGraphViewModel.cs

@@ -379,15 +379,13 @@ internal class NodeGraphViewModel : ViewModelBase, INodeGraphHandler, IDisposabl
     {
         for (int i = AvailableRenderOutputs.Count - 1; i >= 0; i--)
         {
-            if (!outputs.ContainsKey(AvailableRenderOutputs[i]))
+            var outputName = AvailableRenderOutputs[i];
+            if (!outputs.ContainsKey(outputName))
             {
                 AvailableRenderOutputs.RemoveAt(i);
             }
 
-            if (CustomRenderOutputs.ContainsKey(AvailableRenderOutputs[i]))
-            {
-                CustomRenderOutputs.Remove(AvailableRenderOutputs[i]);
-            }
+            CustomRenderOutputs.Remove(outputName);
         }
     }