Code:
---------------------------------------------------
...
IDirectFBSurface * primary_surface = NULL;
DFBSurfaceDescription primary_surface_description;
primary_surface_description.flags = DSDESC_CAPS;
primary_surface_description.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
if( (dfberr = main_interface->CreateSurface( main_interface,
&primary_surface_description, &primary_surface )) != DFB_OK )
{ DirectFBErrorFatal( "CreateSurface( main_interface,
&primary_surface_description, &primary_surface )", dfberr); }
if( (dfberr = primary_surface->GetSize( primary_surface,
&(screen.width), &(screen.height) )) != DFB_OK )
{ DirectFBErrorFatal( "GetSize( primary_surface, &screen_width,
&screen_height )", dfberr); }
IDirectFBSurface * willow_surface = NULL;
DFBSurfaceDescription willow_surface_description;
willow_surface_description.flags = DSDESC_CAPS | DSDESC_WIDTH |
DSDESC_HEIGHT;
willow_surface_description.caps = /*DSCAPS_PRIMARY (1) |*/
DSCAPS_FLIPPING; /*| DSCAPS_SUBSURFACE; (2) */
willow_surface_description.width = screen.width/4;
willow_surface_description.height = screen.height/4;
if( (dfberr = main_interface->CreateSurface( main_interface,
&willow_surface_description, &willow_surface )) != DFB_OK )
{ DirectFBErrorFatal( "CreateSurface( main_interface,
&willow_surface_description, &willow_surface )", dfberr); }
if( (dfberr = primary_surface->SetColor( primary_surface, 0xf0, 0x00,
0x00, 0xa0 )) != DFB_OK )
{ DirectFBErrorFatal( "SetColor( primary_surface, 0xf0, 0x00, 0x00 0xa0
)", dfberr); }
if( (dfberr = willow_surface->SetColor( willow_surface, 0x00, 0xf0,
0x00, 0xa0 )) != DFB_OK )
{ DirectFBErrorFatal( "SetColor( primary_surface, 0x00, 0xf0, 0x00 0xa0
)", dfberr); }
if( (dfberr = primary_surface->FillRectangle( primary_surface, 0, 0,
screen.width, screen.height )) != DFB_OK )
{ DirectFBErrorFatal( "FillRectangle( primary_surface, 0, 0,
screen.width, screen.height )", dfberr); }
if( (dfberr = willow_surface->FillRectangle( willow_surface, 0, 0,
willow_surface_description.width, willow_surface_description.height ))
!= DFB_OK )
{ DirectFBErrorFatal( "FillRectangle( willow_surface, 0, 0,
willow_surface_description.width, willow_surface_description.height )",
dfberr); }
if( (dfberr = primary_surface->Flip( primary_surface, NULL, 0 )) !=
DFB_OK ) /* (3) */
{ DirectFBErrorFatal( "Flip( primary_surface, NULL, 0 )", dfberr); }
if( (dfberr = willow_surface->Flip( willow_surface, NULL, 0 )) != DFB_OK )
{ DirectFBErrorFatal( "Flip( willow_surface, NULL, 0 )", dfberr); }
sleep(5);
...
---------------------------------------------------
All code compile and run withought errors, warnings.
Questions:
I) If I use only primary_surface (comment out everything
willow_surface), screen flash red - OK.
II) When I comment out (3) then screen is black. Why ? I thought there
should be green rectangle in left up corner.
III) If code is as you see, then all screen flash red, no green
rectangle appears. Why?
IV) If I uncomment (1) then no error while program running, but screen
is black. Is it ok to have two primary surfaces for one super interface?
If not then why no error occure during program execution, when creating
willow_surface ?
V) If I uncomment (2) I still see only red screen withought green
rectangle.
To what purposes are subsurfaces?
What I do wrong that I can not see green rectangle ?
----------------------------------------------------------------------
Szukasz pracy? Sprawdź nasze oferty!
http://link.interia.pl/f22b8
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users