Forgot to include this in the last patch

db4
Slava Pestov 2008-11-11 02:35:27 -06:00
parent d579628d61
commit bb44effcb3
1 changed files with 13 additions and 8 deletions

View File

@ -23,7 +23,7 @@ SYMBOL: viewport-translation
[ rect-intersect ] keep
dim>> dup { 0 1 } v* viewport-translation set
{ 0 0 } over gl-viewport
0 swap first2 0 gluOrtho2D
-0.5 swap first2 [ 0.5 - ] [ 0.5 + ] bi* 0.5 gluOrtho2D
clip set
do-clip ;
@ -103,26 +103,31 @@ GENERIC: recompute-pen ( gadget pen -- )
] if ;
! Solid fill/border
TUPLE: solid < caching-pen color last-vertices ;
TUPLE: solid < caching-pen color interior-vertices boundary-vertices ;
: <solid> ( color -- solid ) solid new swap >>color ;
M: solid recompute-pen
swap dim>> (rectangle-vertices) >>last-vertices drop ;
swap dim>>
[ (fill-rect-vertices) >>interior-vertices ]
[ (rect-vertices) >>boundary-vertices ]
bi drop ;
<PRIVATE
! Solid pen
: (solid) ( gadget pen -- )
[ compute-pen ]
[ color>> gl-color ]
[ last-vertices>> gl-vertex-pointer ] tri ;
[ compute-pen ] [ color>> gl-color ] bi ;
PRIVATE>
M: solid draw-interior (solid) (gl-fill-rect) ;
M: solid draw-interior
[ (solid) ] [ interior-vertices>> gl-vertex-pointer ] bi
(gl-fill-rect) ;
M: solid draw-boundary (solid) (gl-rect) ;
M: solid draw-boundary
[ (solid) ] [ boundary-vertices>> gl-vertex-pointer ] bi
(gl-rect) ;
! Gradient pen
TUPLE: gradient < caching-pen colors last-vertices last-colors ;