charts.lines: add dummy drawable-chunks

char-rename
Alexander Iljin 2017-01-08 14:14:56 +03:00 committed by John Benediktsson
parent 13c197aa26
commit e9606b38d9
1 changed files with 8 additions and 1 deletions

View File

@ -59,6 +59,12 @@ TUPLE: line < gadget color data ;
2drop { } clone
] if ;
! Split data into chunks to be drawn within the [ymin,ymax] limits.
! Return the (empty?) sequence of chunks, possibly with some new
! points at ymin and ymax at the gap bounds.
: drawable-chunks ( ymin,ymax data -- chunks )
1array nip ;
PRIVATE>
: draw-line ( seq -- )
@ -81,5 +87,6 @@ M: line draw-gadget*
dup parent>> dup chart? [
chart-axes swap
[ color>> gl-color ] [ data>> ] bi
clip-data [ draw-line ] unless-empty
dupd clip-data [ second ] dip drawable-chunks
[ [ draw-line ] each ] unless-empty
] [ 2drop ] if ;