on master help sign in
remove unused add_unclipped
commitef226f9e5372e0a8f629ed813dbf105622e73475 authorCorey O'Connor <corey@ooyala.com> dateFri 26 Jul 2013, 21:27 (13 years ago) parente31a531
4 files changed+8−45
README.md+1 src/Graphics/Vty.hs+2−2 src/Graphics/Vty/PictureToSpans.hs+2−40 test/Verify/Graphics/Vty/Image.hs+3−3
README.md+1
@@ -63,6 +63,7 @@ Profiling appears to cause issues with coverage when enabled. To evaluate covera
6363follows:
6464
6565~~~
66+rm -rf dist
6667cabal configure --enable-tests --enable-library-coverage \
6768 --disable-library-profiling \
6869 --disable-executable-profiling
src/Graphics/Vty.hs+2−2
@@ -80,8 +80,8 @@ mkVty = mkVtyEscDelay 0
8080-- following reading ESC from the terminal before considering the ESC key press as a discrete event.
8181-- \todo move input init into terminal interface
8282mkVtyEscDelay :: Int -> IO Vty
83−mkVtyEscDelay escDelay = do
84− term_info <- Terminfo.setupTermFromEnv
83+mkVtyEscDelay escDelay = do
84+ term_info <- Terminfo.setupTermFromEnv
8585 t <- current_terminal
8686 reserve_display t
8787 (kvar, endi) <- initTermInput escDelay term_info
src/Graphics/Vty/PictureToSpans.hs+2−40
@@ -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
test/Verify/Graphics/Vty/Image.hs+3−3
@@ -80,9 +80,9 @@ instance Arbitrary SingleAttrSingleSpanStack where
8080 arbitrary = do
8181 image_list <- Verify.resize 128 (listOf1 arbitrary)
8282 let image = vert_cat [ i | SingleRowSingleAttrImage { row_image = i } <- image_list ]
83− return $ SingleAttrSingleSpanStack
84− image
85− image_list
83+ return $ SingleAttrSingleSpanStack
84+ image
85+ image_list
8686 ( maximum $ map expected_columns image_list )
8787 ( toEnum $ length image_list )
8888