From 54e9447ec428e39757526678b1c7823e440f08e8 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Fri, 1 May 2009 20:07:14 -0500 Subject: [PATCH] adjust pixel format syntax. override offscreen-world pixel-format-attributes instead of special-casing --- basis/ui/backend/cocoa/cocoa.factor | 9 ++++----- basis/ui/pixel-formats/pixel-formats.factor | 6 +++--- extra/ui/offscreen/offscreen.factor | 3 +++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/basis/ui/backend/cocoa/cocoa.factor b/basis/ui/backend/cocoa/cocoa.factor index ba0a7b9c7e..297996e9db 100755 --- a/basis/ui/backend/cocoa/cocoa.factor +++ b/basis/ui/backend/cocoa/cocoa.factor @@ -24,7 +24,7 @@ SINGLETON: cocoa-ui-backend [ - :> 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 >>handle drop ; diff --git a/basis/ui/pixel-formats/pixel-formats.factor b/basis/ui/pixel-formats/pixel-formats.factor index 5c16407135..dc613604a6 100644 --- a/basis/ui/pixel-formats/pixel-formats.factor +++ b/basis/ui/pixel-formats/pixel-formats.factor @@ -63,7 +63,7 @@ M: pixel-format dispose 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> diff --git a/extra/ui/offscreen/offscreen.factor b/extra/ui/offscreen/offscreen.factor index 8d197eb844..c6669eb16f 100755 --- a/extra/ui/offscreen/offscreen.factor +++ b/extra/ui/offscreen/offscreen.factor @@ -6,6 +6,9 @@ IN: ui.offscreen TUPLE: offscreen-world < world ; +M: offscreen-world world-pixel-format-attributes + { offscreen T{ depth-bits { value 16 } } } ; + : ( gadget title status -- world ) offscreen-world new-world ;