         _ [ check-cairo ] bi
     ] with-destructors ; inline
 
-: check-surface ( surface -- ) cairo_surface_status check-cairo ;
+: check-surface ( surface -- ) cairo_surface_status (check-cairo) ;
 
 : with-surface ( cairo_surface quot -- )
     '[

: width>stride ( width -- stride ) "uint" heap-size * ; inline

: <image-surface> ( data dim -- surface )
    first2 over width>stride CAIRO_FORMAT_ARGB32
    cairo_image_surface_create_for_data
    dup check-surface ;

: make-bitmap-image ( dim quot -- image )
    '[ <image-surface> &cairo_surface_destroy @ ] make-memory-bitmap ; inline

! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: cairo.ffi alien.c-types kernel accessors sequences
namespaces fry continuations destructors math images.memory ;
IN: cairo

ERROR: cairo-error message ;
