on master help sign in
remove unused add_unclipped
ef226f9Corey O'Connor
README.md+1
@@ -63,6 +63,7 @@ Profiling appears to cause issues with coverage when enabled. To evaluate covera
63follows:
63follows:
64
64
65~~~
65~~~
66+rm -rf dist
66cabal configure --enable-tests --enable-library-coverage \
67cabal configure --enable-tests --enable-library-coverage \
67 --disable-library-profiling \
68 --disable-library-profiling \
68 --disable-executable-profiling
69 --disable-executable-profiling
src/Graphics/Vty.hs+2−2
@@ -80,8 +80,8 @@ mkVty = mkVtyEscDelay 0
80-- following reading ESC from the terminal before considering the ESC key press as a discrete event.
80-- following reading ESC from the terminal before considering the ESC key press as a discrete event.
81-- \todo move input init into terminal interface
81-- \todo move input init into terminal interface
82mkVtyEscDelay :: Int -> IO Vty
82mkVtyEscDelay :: Int -> IO Vty
83−mkVtyEscDelay escDelay = do
83+mkVtyEscDelay escDelay = do
84− term_info <- Terminfo.setupTermFromEnv
84+ term_info <- Terminfo.setupTermFromEnv
85 t <- current_terminal
85 t <- current_terminal
86 reserve_display t
86 reserve_display t
87 (kvar, endi) <- initTermInput escDelay term_info
87 (kvar, endi) <- initTermInput escDelay term_info
src/Graphics/Vty/PictureToSpans.hs+2−40
@@ -178,45 +178,6 @@ is_out_of_bounds s
178 | s ^. remaining_rows <= 0 = True
178 | s ^. remaining_rows <= 0 = True
179 | otherwise = False
179 | otherwise = False
180
180
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−
220-- TODO: prove this cannot be called in an out of bounds case.
181-- TODO: prove this cannot be called in an out of bounds case.
221add_maybe_clipped :: forall s . Image -> BlitM s ()
182add_maybe_clipped :: forall s . Image -> BlitM s ()
222add_maybe_clipped EmptyImage = return ()
183add_maybe_clipped EmptyImage = return ()
@@ -249,7 +210,8 @@ add_maybe_clipped BGFill {output_width, output_height} = do
249 s <- get
210 s <- get
250 let output_width' = min (output_width - s^.skip_columns) (s^.remaining_columns)
211 let output_width' = min (output_width - s^.skip_columns) (s^.remaining_columns)
251 output_height' = min (output_height - s^.skip_rows ) (s^.remaining_rows)
212 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')
253add_maybe_clipped CropRight {cropped_image, output_width} = do
215add_maybe_clipped CropRight {cropped_image, output_width} = do
254 remaining_columns .= output_width
216 remaining_columns .= output_width
255 add_maybe_clipped cropped_image
217 add_maybe_clipped cropped_image
test/Verify/Graphics/Vty/Image.hs+3−3
@@ -80,9 +80,9 @@ instance Arbitrary SingleAttrSingleSpanStack where
80 arbitrary = do
80 arbitrary = do
81 image_list <- Verify.resize 128 (listOf1 arbitrary)
81 image_list <- Verify.resize 128 (listOf1 arbitrary)
82 let image = vert_cat [ i | SingleRowSingleAttrImage { row_image = i } <- image_list ]
82 let image = vert_cat [ i | SingleRowSingleAttrImage { row_image = i } <- image_list ]
83− return $ SingleAttrSingleSpanStack
83+ return $ SingleAttrSingleSpanStack
84− image
84+ image
85− image_list
85+ image_list
86 ( maximum $ map expected_columns image_list )
86 ( maximum $ map expected_columns image_list )
87 ( toEnum $ length image_list )
87 ( toEnum $ length image_list )
88
88