From 1b47e809942c5c45b2094c81287c6d6fb47ba9f3 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 18 Nov 2008 22:18:35 -0600 Subject: [PATCH] Clean up some specialized array usage --- basis/opengl/opengl.factor | 16 ++++++++-------- basis/ui/gadgets/buttons/buttons.factor | 2 +- basis/ui/render/render.factor | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/basis/opengl/opengl.factor b/basis/opengl/opengl.factor index 5497229b6c..5fd0f56bbf 100644 --- a/basis/opengl/opengl.factor +++ b/basis/opengl/opengl.factor @@ -53,20 +53,20 @@ MACRO: all-enabled-client-state ( seq quot -- ) glMatrixMode glPopMatrix ; inline : gl-material ( face pname params -- ) - >float-array underlying>> glMaterialfv ; + float-array{ } like underlying>> glMaterialfv ; : gl-vertex-pointer ( seq -- ) - [ 2 GL_FLOAT 0 ] dip glVertexPointer ; inline + [ 2 GL_FLOAT 0 ] dip underlying>> glVertexPointer ; inline : gl-color-pointer ( seq -- ) - [ 4 GL_FLOAT 0 ] dip glColorPointer ; inline + [ 4 GL_FLOAT 0 ] dip underlying>> glColorPointer ; inline : gl-texture-coord-pointer ( seq -- ) [ 2 GL_FLOAT 0 ] dip glTexCoordPointer ; inline : line-vertices ( a b -- ) - [ first2 [ 0.5 + ] bi@ ] bi@ 4 narray - >float-array underlying>> gl-vertex-pointer ; + [ first2 [ 0.5 + ] bi@ ] bi@ 4 float-array{ } nsequence + gl-vertex-pointer ; : gl-line ( a b -- ) line-vertices GL_LINES 0 2 glDrawArrays ; @@ -77,7 +77,7 @@ MACRO: all-enabled-client-state ( seq quot -- ) [ first 0.3 - 0.5 ] [ [ first 0.3 - ] [ second 0.3 - ] bi ] [ second 0.3 - 0.5 swap ] - } cleave 8 float-array{ } nsequence underlying>> ; + } cleave 8 float-array{ } nsequence ; : rect-vertices ( dim -- ) (rect-vertices) gl-vertex-pointer ; @@ -94,7 +94,7 @@ MACRO: all-enabled-client-state ( seq quot -- ) [ first 0 ] [ first2 ] [ second 0 swap ] - } cleave 8 float-array{ } nsequence underlying>> ; + } cleave 8 float-array{ } nsequence ; : fill-rect-vertices ( dim -- ) (fill-rect-vertices) gl-vertex-pointer ; @@ -121,7 +121,7 @@ MACRO: all-enabled-client-state ( seq quot -- ) circle-steps unit-circle adjust-points scale-points ; : circle-vertices ( loc dim steps -- vertices ) - circle-points concat >float-array underlying>> ; + circle-points concat >float-array ; : (gen-gl-object) ( quot -- id ) >r 1 0 r> keep *uint ; inline diff --git a/basis/ui/gadgets/buttons/buttons.factor b/basis/ui/gadgets/buttons/buttons.factor index ffc0aa63c4..f89407ba8b 100644 --- a/basis/ui/gadgets/buttons/buttons.factor +++ b/basis/ui/gadgets/buttons/buttons.factor @@ -118,7 +118,7 @@ TUPLE: checkmark-paint < caching-pen color last-vertices ; } cleave 4array ; : checkmark-vertices ( dim -- vertices ) - checkmark-points concat >float-array underlying>> ; + checkmark-points concat >float-array ; PRIVATE> diff --git a/basis/ui/render/render.factor b/basis/ui/render/render.factor index 94efd1bf22..ec400abe8c 100755 --- a/basis/ui/render/render.factor +++ b/basis/ui/render/render.factor @@ -140,11 +140,11 @@ TUPLE: gradient < caching-pen colors last-vertices last-colors ; direction dim v* dim over v- swap colors length dup 1- v/n [ v*n ] with map [ dup rot v+ 2array ] with map - concat concat >float-array underlying>> ; + concat concat >float-array ; : gradient-colors ( colors -- seq ) [ color>raw 4array dup 2array ] map concat concat - >float-array underlying>> ; + >float-array ; M: gradient recompute-pen ( gadget gradient -- ) tuck @@ -172,7 +172,7 @@ M: gradient draw-interior TUPLE: polygon color vertex-array count ; : ( color points -- polygon ) - [ concat >float-array underlying>> ] [ length ] bi polygon boa ; + [ concat >float-array ] [ length ] bi polygon boa ; : draw-polygon ( polygon mode -- ) swap