Hi,
I am trying to create an application displaying jpgs downloaded from the
internet, with an interface over it.
To that end, I wanted to create 3 threads:
. thread 1 => download the images & show them in a DirectFBSurface (pict_sf),
with a transition effect
. thread 2 => Get user input & show the interface if need be in a
DirectFBSurface (if_sf)
. thread 3 => compose pict_sf & if_sf & display it to the screen
However I am having trouble creating the surfaces pict_sf & if_sf. I have the
following code to init my application:
/* screen */
IDirectFBSurface *sf_screen = NULL;
/* surface bg photos */
IDirectFBSurface *sf_photos[2];
void display_init(int argc_, char **argv_) {
DFBSurfaceDescription dsc_screen;
DFBSurfaceDescription dsc_sf;
DFBFontDescription font_dsc;
DFBCHECK(DirectFBInit(&argc_, &argv_));
DFBCHECK(DirectFBCreate(&dfb));
/* Screen */
DFBCHECK(dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN));
dsc_screen.flags = DSDESC_CAPS;
dsc_screen.caps = DSCAPS_PRIMARY ;
DFBCHECK(dfb->CreateSurface(dfb, &dsc_screen, &sf_screen));
DFBCHECK(sf_screen->SetBlittingFlags(sf_screen, DSBLIT_BLEND_ALPHACHANNEL));
DFBCHECK(sf_screen->SetPorterDuff(sf_screen, DSPD_SRC_OVER));
DFBCHECK(sf_screen->GetSize(sf_screen, &screen_width, &screen_height));
/* recupere ses dimensions en globales */
/* problematic part */
/* dsc_sf.flags = DSDESC_WIDTH | DSDESC_HEIGHT;
dsc_sf.height = screen_height;
dsc_sf.width = screen_width;*/
DFBCHECK(dfb->CreateSurface(dfb, &dsc_sf, &sf_photos[0]));
DFBCHECK(dfb->CreateSurface(dfb, &dsc_sf, &sf_photos[1]));
/* initialisation font */
font_dsc.flags = DFDESC_HEIGHT;
font_dsc.height = 10;
DFBCHECK(dfb->CreateFont(dfb, "./font.ttf", &font_dsc, &font));
DFBCHECK(sf_screen->SetFont(sf_screen, font));
}
The problem comes from the dsc_sf initialisation part. If I comment it out, I
can display images on my x84_64 under fc6 computer, however my uclibc-enabled
arm (a gumstix) dies with:
--> Invalid argument
display.c <54>:
(#) DirectFBError [dfb->CreateSurface(dfb, &dsc_sf, &sf_photos[0])]:
Invalid argument!
And indeed valgrind complains from uninitialised variables:
==31005== Conditional jump or move depends on uninitialised value(s)
==31005== at 0x4C37540: IDirectFB_CreateSurface (idirectfb.c:437)
==31005== by 0x401B48: display_init (display.c:54)
==31005== by 0x4012C5: main (main.c:13)
display.c:54 is DFBCHECK(dfb->CreateSurface(dfb, &dsc_sf, &sf_photos[0]));
idirectfb.c:437 is if (desc->flags & DSDESC_WIDTH) {
This is directfb 1.0 on both system.
If I uncomment it and set dsc_sf.flags, valgrind stops complaining, but I can't
see a picture anymore, either on my x86_64 or my arm :(
I tried setting the pixel format as well, but I didn't have any more luck
either.
I think I am missing something, but I don't see what :( How should I initialize
the surface ?
Thanks,
Benjamin
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users