I want to use Cairo with DirectFB, but it cause system to crash, can anyone
help me?
#include <stdio.h>
#include <unistd.h>
#include <directfb.h>
#include <cairo.h>
#include <cairo-features.h>
/*
* Disable cairo DirectFB backend until it becomes stable enough.
*/
#ifdef CAIRO_HAS_DIRECTFB_SURFACE
# include <cairo-directfb.h>
#endif
static IDirectFB *dfb = NULL;
static IDirectFBSurface *primary = NULL;
static int screen_width = 0;
static int screen_height = 0;
#define DFBCHECK(x...) \
{ \
DFBResult err = x; \
\
if (err != DFB_OK) \
{ \
fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
DirectFBErrorFatal( #x, err ); \
} \
}
int main (int argc, char **argv)
{
DFBSurfaceDescription dsc;
DFBCHECK (DirectFBInit (&argc, &argv));
DFBCHECK (DirectFBCreate (&dfb));
DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
cairo_surface_t *csurface=cairo_directfb_surface_create(dfb,primary);
cairo_surface_destroy(csurface);
primary->Release( primary );
dfb->Release( dfb );
return 23;
}
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users