@@ -91,9 +91,6 @@ displayOpsForImage :: Image -> DisplayOps
9191displayOpsForImage i = displayOpsForPic (picForImage i) (imageWidth i, imageHeight i)
9292
9393-- | Produces the span ops for each layer then combines them.
94−--
95−-- TODO: a fold over a builder function. start with span ops that are a
96−-- bg fill of the entire region.
9794combinedOpsForLayers :: Picture -> DisplayRegion -> ST s (MRowOps s)
9895combinedOpsForLayers pic r
9996 | regionWidth r == 0 || regionHeight r == 0 = MVector.new 0
@@ -118,7 +115,6 @@ substituteSkips ClearBackground ops = do
118115 -- but only by the insertion of a non skip. all this combines to
119116 -- mean we can check the last operation and remove it if it's a
120117 -- skip
121− -- todo: or does it?
122118 let rowOps' = case Vector.last rowOps of
123119 Skip w -> Vector.init rowOps `Vector.snoc` RowEnd w
124120 _ -> rowOps
@@ -197,17 +193,12 @@ swapSkipsForCharSpan w c a = Vector.map f
197193-- picture to the terminal.
198194--
199195-- Crops to the given display region.
200−--
201−-- \todo I'm pretty sure there is an algorithm that does not require a
202−-- mutable buffer.
203196buildSpans :: Image -> DisplayRegion -> ST s (MRowOps s)
204197buildSpans image outRegion = do
205198 -- First we create a mutable vector for each rows output operations.
206199 outOps <- MVector.replicate (regionHeight outRegion) Vector.empty
207− -- \todo I think building the span operations in display order
208− -- would provide better performance. However, I got stuck trying to
209− -- implement an algorithm that did this. This will be considered as
210− -- a possible future optimization.
200+ -- It's possible that building the span operations in display order
201+ -- would provide better performance.
211202 --
212203 -- A depth first traversal of the image is performed. ordered
213204 -- according to the column range defined by the image from least
@@ -255,12 +246,10 @@ isOutOfBounds i s
255246-- This is a very touchy algorithm. Too touchy. For instance, the
256247-- CropRight and CropBottom implementations are odd. They pass the
257248-- current tests but something seems terribly wrong about all this.
258−--
259−-- \todo prove this cannot be called in an out of bounds case.
260249addMaybeClipped :: forall s . Image -> BlitM s ()
261250addMaybeClipped EmptyImage = return ()
262251addMaybeClipped (HorizText a textStr ow _cw) = do
263− -- TODO: assumption that text spans are only 1 row high.
252+ -- This assumes that text spans are only 1 row high.
264253 s <- use skipRows
265254 when (s < 1) $ do
266255 leftClip <- use skipColumns
@@ -323,8 +312,7 @@ addMaybeClippedJoin name skip remaining offset i0Dim i0 i1 size = do
323312 state <- get
324313 when (state^.remaining <= 0) $ fail $ name ++ " with remaining <= 0"
325314 case state^.skip of
326− s -- TODO: check if clipped in other dim. if not use addUnclipped
327− | s > size -> put $ state & skip -~ size
315+ s | s > size -> put $ state & skip -~ size
328316 | s == 0 -> if state^.remaining > i0Dim
329317 then do
330318 addMaybeClipped i0