From cf3bd4c99fe15b43aa508c3cfc30a87fd04bd168 Mon Sep 17 00:00:00 2001 From: Jonathan Daugherty Date: Sat, 3 Dec 2016 17:49:49 -0800 Subject: [PATCH] addMaybeClipped: skip blit of joins when their primary dimension is zero --- src/Graphics/Vty/PictureToSpans.hs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Graphics/Vty/PictureToSpans.hs b/src/Graphics/Vty/PictureToSpans.hs index 84b7a96..b25f0ee 100644 --- a/src/Graphics/Vty/PictureToSpans.hs +++ b/src/Graphics/Vty/PictureToSpans.hs @@ -259,17 +259,19 @@ addMaybeClipped (HorizText a textStr ow _cw) = do in addUnclippedText a textStr' else addUnclippedText a textStr addMaybeClipped (VertJoin topImage bottomImage _ow oh) = do - addMaybeClippedJoin "vert_join" skipRows remainingRows rowOffset - (imageHeight topImage) - topImage - bottomImage - oh + when (imageHeight topImage + imageHeight bottomImage > 0) $ + addMaybeClippedJoin "vert_join" skipRows remainingRows rowOffset + (imageHeight topImage) + topImage + bottomImage + oh addMaybeClipped (HorizJoin leftImage rightImage ow _oh) = do - addMaybeClippedJoin "horiz_join" skipColumns remainingColumns columnOffset - (imageWidth leftImage) - leftImage - rightImage - ow + when (imageWidth leftImage + imageWidth rightImage > 0) $ + addMaybeClippedJoin "horiz_join" skipColumns remainingColumns columnOffset + (imageWidth leftImage) + leftImage + rightImage + ow addMaybeClipped BGFill {outputWidth, outputHeight} = do s <- get let outputWidth' = min (outputWidth - s^.skipColumns) (s^.remainingColumns)