]> gitweb.factorcode.org Git - factor.git/commitdiff
adjust pixel format syntax. override offscreen-world pixel-format-attributes instead...
authorJoe Groff <arcata@gmail.com>
Sat, 2 May 2009 01:07:14 +0000 (20:07 -0500)
committerJoe Groff <arcata@gmail.com>
Sat, 2 May 2009 01:07:14 +0000 (20:07 -0500)
basis/ui/backend/cocoa/cocoa.factor
basis/ui/pixel-formats/pixel-formats.factor
extra/ui/offscreen/offscreen.factor

index ba0a7b9c7e28c86c0be7fefb8c0a17beb1ae3646..297996e9db5797c3cc36f32687a1323cbde6ba0c 100755 (executable)
@@ -24,7 +24,7 @@ SINGLETON: cocoa-ui-backend
 
 <PRIVATE
 
-PIXEL-FORMAT-ATTRIBUTE-TABLE: NSOpenGLPFA H{
+PIXEL-FORMAT-ATTRIBUTE-TABLE: NSOpenGLPFA { } H{
     { double-buffered { $ NSOpenGLPFADoubleBuffer } }
     { stereo { $ NSOpenGLPFAStereo } }
     { offscreen { $ NSOpenGLPFAOffScreen } }
@@ -148,13 +148,12 @@ M: cocoa-ui-backend raise-window* ( world -- )
     { [ * * malloc ] [ 2drop ] [ drop nip ] [ nip * ] } 3cleave ;
 
 :: gadget-offscreen-context ( world -- context buffer )
-    world world-pixel-format-attributes offscreen suffix
-    <pixel-format> [
-        :> pf
+    world [
+        nip :> pf
         NSOpenGLContext -> alloc pf handle>> f -> initWithFormat:shareContext:
         dup world pf offscreen-buffer
         4 npick [ -> setOffScreen:width:height:rowbytes: ] dip
-    ] with-disposal ;
+    ] with-world-pixel-format ;
 
 M: cocoa-ui-backend (open-offscreen-buffer) ( world -- )
     dup gadget-offscreen-context <offscreen-handle> >>handle drop ;
index 5c16407135ecb7a88929dad22b0e5a5c9bcc1a93..dc613604a6b2665a940bf3f114c10aa3b0353520 100644 (file)
@@ -63,7 +63,7 @@ M: pixel-format dispose
 
 <PRIVATE
 
-FUNCTOR: define-pixel-format-attribute-table ( NAME TABLE -- )
+FUNCTOR: define-pixel-format-attribute-table ( NAME PERM TABLE -- )
 
 >PFA              DEFINES >${NAME}
 >PFA-int-array    DEFINES >${NAME}-int-array
@@ -82,11 +82,11 @@ M: pixel-format-attribute >PFA
     [ drop { } ] if* ;
 
 : >PFA-int-array ( attribute -- int-array )
-    [ >PFA ] map concat 0 suffix >int-array ;
+    [ >PFA ] map concat PERM prepend 0 suffix >int-array ;
 
 ;FUNCTOR
 
 SYNTAX: PIXEL-FORMAT-ATTRIBUTE-TABLE:
-    scan scan-object define-pixel-format-attribute-table ;
+    scan scan-object scan-object define-pixel-format-attribute-table ;
 
 PRIVATE>
index 8d197eb844e7eba490fdfbb93a862ffc4fb4c4ec..c6669eb16f17dd23d6a20a77f9c4be658f40f368 100755 (executable)
@@ -6,6 +6,9 @@ IN: ui.offscreen
 
 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 new-world ;