From daf8f7790e8f91075861347514a2922d1b6b8e6b Mon Sep 17 00:00:00 2001 From: Cameron White Date: Thu, 28 Dec 2023 14:40:38 -0500 Subject: [PATCH] Support rendering non-tileable effects (#637) This is a fairly unintrusive change to support non-tileable effects. If the effect isn't tileable, we just create a single tile for the whole render bounds. Related to PR #457 --- Pinta.Core/Managers/LivePreviewManager.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Pinta.Core/Managers/LivePreviewManager.cs b/Pinta.Core/Managers/LivePreviewManager.cs index fc4d4fe5f..5e7bb7b27 100644 --- a/Pinta.Core/Managers/LivePreviewManager.cs +++ b/Pinta.Core/Managers/LivePreviewManager.cs @@ -109,10 +109,17 @@ public void Start (BaseEffect effect) Started?.Invoke (this, new LivePreviewStartedEventArgs ()); + // If the effect isn't tileable, there is a single tile for the entire render bounds. + // Otherwise, render each row in parallel. + int tileWidth = render_bounds.Width; + int tileHeight = 1; + if (!effect.IsTileable) + tileHeight = render_bounds.Height; + var settings = new AsyncEffectRenderer.Settings () { ThreadCount = PintaCore.System.RenderThreads, - TileWidth = render_bounds.Width, - TileHeight = 1, + TileWidth = tileWidth, + TileHeight = tileHeight, ThreadPriority = ThreadPriority.BelowNormal };