@@ -178,45 +178,6 @@ is_out_of_bounds s
178178 | s ^. remaining_rows <= 0 = True
179179 | otherwise = False
180180
181−-- TODO: prove skip_columns, skip_rows == 0
182−-- TODO: prove remaining_columns >= image_width
183−-- TODO: prove remaining_rows >= image_height
184−add_unclipped :: Image -> BlitM s ()
185−add_unclipped EmptyImage = return ()
186−add_unclipped (HorizText a text_str _ow _cw) = do
187− use row_offset >>= snoc_op (AttributeChange a)
188− add_unclipped_text text_str
189−add_unclipped (HorizJoin part_left part_right _ow _oh) = do
190− -- TODO: push into env and use
191− y <- use row_offset
192− add_unclipped part_left
193− row_offset .= y
194− add_unclipped part_right
195−add_unclipped (VertJoin part_top part_bottom _ow _oh) = do
196− y <- use row_offset
197− add_unclipped part_top
198− row_offset .= y + image_height part_top
199− add_unclipped part_bottom
200−add_unclipped (BGFill ow oh) = do
201− y <- use row_offset
202− let op = Skip ow
203− forM_ [y..y+oh-1] $ \row -> do
204− snoc_op op row
205−-- TODO: we know it's clipped actually, the equations that are exposed that introduce a
206−-- Crop all assure the image exceeds the crop in the relevant direction.
207−add_unclipped CropRight {cropped_image, output_width} = do
208− remaining_columns .= output_width
209− add_maybe_clipped cropped_image
210−add_unclipped CropLeft {cropped_image, left_skip} = do
211− skip_columns .= left_skip
212− add_maybe_clipped cropped_image
213−add_unclipped CropBottom {cropped_image, output_height} = do
214− remaining_rows .= output_height
215− add_maybe_clipped cropped_image
216−add_unclipped CropTop {cropped_image, top_skip} = do
217− skip_rows .= top_skip
218− add_maybe_clipped cropped_image
219−
220181-- TODO: prove this cannot be called in an out of bounds case.
221182add_maybe_clipped :: forall s . Image -> BlitM s ()
222183add_maybe_clipped EmptyImage = return ()
@@ -249,7 +210,8 @@ add_maybe_clipped BGFill {output_width, output_height} = do
249210 s <- get
250211 let output_width' = min (output_width - s^.skip_columns) (s^.remaining_columns)
251212 output_height' = min (output_height - s^.skip_rows ) (s^.remaining_rows)
252− add_unclipped (BGFill output_width' output_height')
213+ y <- use row_offset
214+ forM_ [y..y+output_height'-1] $ snoc_op (Skip output_width')
253215add_maybe_clipped CropRight {cropped_image, output_width} = do
254216 remaining_columns .= output_width
255217 add_maybe_clipped cropped_image