Your actual code reads void *bmpdata1 = malloc(size); void *bmpdata = malloc(size); bmpdata = memset (&bmpdata1,0xFF,size);
That's obviously bad, but you fixed it in the code you pasted here -- you really don't to assign the return value of memset to anything, it always returns the pointer passed into it. The rest of the code looks OK to me. The lines out_desc.preallocated[1].data = NULL; //What is it? Please answer. out_desc.preallocated[1].pitch = 0; are OK... that's setting the data for the non-existent back bufffer. I'd suggest using a debugger and inspecting the bmpdata array before the blit happens. Finally, questiions about using the DirectFB libraries should go to the directfb-users mailing list, not directfb-dev. On 7/30/07, Michael Metsger <[EMAIL PROTECTED]> wrote: > I have a problem. > First I make surface with prelocated data(default videomode 640x480x16): > size = 64*64*2; > void *bmpdata = malloc(size); > bmpdata = memset (&bmpdata,0xFF,size); //white square 64x64 > > Then I Create surface and blit: > out_desc.caps = DSCAPS_SYSTEMONLY; > out_desc.flags=(DFBSurfaceDescriptionFlags)(DSDESC_CAPS|DSDESC_WIDTH|DSDESC_HEIGHT|DSDESC_PIXELFORMAT|DSDESC_PREALLOCATED); > out_desc.width = 64; > out_desc.height = 64; > out_desc.pixelformat = DSPF_RGB16; > out_desc.preallocated[0].data = (void*) bmpdata; > out_desc.preallocated[0].pitch = 64*2; > out_desc.preallocated[1].data = NULL; //What is it? Please answer. > out_desc.preallocated[1].pitch = 0; > DFBCHECK( dfb->CreateSurface( dfb, &out_desc, &out_surface ) ) > DFBCHECK (primary->Blit(primary,out_surface,NULL,200,200)); > DFBCHECK (primary->Flip (primary, NULL, 0)); > > And I see white square but top side of them is not line (set of random > points). Where is a error? (full source attached) > > Also How can I bli surface with pixelformat DSPF_A1 to primary surface > with RGB16? > > Please, answer. > > _______________________________________________ > directfb-dev mailing list > [email protected] > http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev > > > _______________________________________________ directfb-dev mailing list [email protected] http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev
