adjust pixel format syntax. override offscreen-world pixel-format-attributes instead of special-casing

db4
Joe Groff 2009-05-01 20:07:14 -05:00
parent 2a7c26c20a
commit 54e9447ec4
3 changed files with 10 additions and 8 deletions

View File

@ -24,7 +24,7 @@ SINGLETON: cocoa-ui-backend
<PRIVATE <PRIVATE
PIXEL-FORMAT-ATTRIBUTE-TABLE: NSOpenGLPFA H{ PIXEL-FORMAT-ATTRIBUTE-TABLE: NSOpenGLPFA { } H{
{ double-buffered { $ NSOpenGLPFADoubleBuffer } } { double-buffered { $ NSOpenGLPFADoubleBuffer } }
{ stereo { $ NSOpenGLPFAStereo } } { stereo { $ NSOpenGLPFAStereo } }
{ offscreen { $ NSOpenGLPFAOffScreen } } { offscreen { $ NSOpenGLPFAOffScreen } }
@ -148,13 +148,12 @@ M: cocoa-ui-backend raise-window* ( world -- )
{ [ * * malloc ] [ 2drop ] [ drop nip ] [ nip * ] } 3cleave ; { [ * * malloc ] [ 2drop ] [ drop nip ] [ nip * ] } 3cleave ;
:: gadget-offscreen-context ( world -- context buffer ) :: gadget-offscreen-context ( world -- context buffer )
world world-pixel-format-attributes offscreen suffix world [
<pixel-format> [ nip :> pf
:> pf
NSOpenGLContext -> alloc pf handle>> f -> initWithFormat:shareContext: NSOpenGLContext -> alloc pf handle>> f -> initWithFormat:shareContext:
dup world pf offscreen-buffer dup world pf offscreen-buffer
4 npick [ -> setOffScreen:width:height:rowbytes: ] dip 4 npick [ -> setOffScreen:width:height:rowbytes: ] dip
] with-disposal ; ] with-world-pixel-format ;
M: cocoa-ui-backend (open-offscreen-buffer) ( world -- ) M: cocoa-ui-backend (open-offscreen-buffer) ( world -- )
dup gadget-offscreen-context <offscreen-handle> >>handle drop ; dup gadget-offscreen-context <offscreen-handle> >>handle drop ;

View File

@ -63,7 +63,7 @@ M: pixel-format dispose
<PRIVATE <PRIVATE
FUNCTOR: define-pixel-format-attribute-table ( NAME TABLE -- ) FUNCTOR: define-pixel-format-attribute-table ( NAME PERM TABLE -- )
>PFA DEFINES >${NAME} >PFA DEFINES >${NAME}
>PFA-int-array DEFINES >${NAME}-int-array >PFA-int-array DEFINES >${NAME}-int-array
@ -82,11 +82,11 @@ M: pixel-format-attribute >PFA
[ drop { } ] if* ; [ drop { } ] if* ;
: >PFA-int-array ( attribute -- int-array ) : >PFA-int-array ( attribute -- int-array )
[ >PFA ] map concat 0 suffix >int-array ; [ >PFA ] map concat PERM prepend 0 suffix >int-array ;
;FUNCTOR ;FUNCTOR
SYNTAX: PIXEL-FORMAT-ATTRIBUTE-TABLE: SYNTAX: PIXEL-FORMAT-ATTRIBUTE-TABLE:
scan scan-object define-pixel-format-attribute-table ; scan scan-object scan-object define-pixel-format-attribute-table ;
PRIVATE> PRIVATE>

View File

@ -6,6 +6,9 @@ IN: ui.offscreen
TUPLE: offscreen-world < world ; TUPLE: offscreen-world < world ;
M: offscreen-world world-pixel-format-attributes
{ offscreen T{ depth-bits { value 16 } } } ;
: <offscreen-world> ( gadget title status -- world ) : <offscreen-world> ( gadget title status -- world )
offscreen-world new-world ; offscreen-world new-world ;