I added a call to GetVisibleRect which gives basically the visible
region of the main surface in the subsurface coordinates seems to work
but I'm thinking when you lock the surface
one of the params should be a rectangle that is the visible rect ?

Mike


On 7/8/06, Mike Emmel <[EMAIL PROTECTED]> wrote:
> Hi all I've just found a pretty nasty situation.
>
> If you create a sub surface of a surface thats offset from its parent
> say negative.
>
> Then Lock the surface. The data you get back is actually at its
> parents 00 coordinate
> so Locking a subsurface actuall locks the parent surface.
>
> Further direct drawing on the subsurface is of course  in the wrong
> place and potentially
> crashes.
>
>
> This is a pretty ugly situation.
>
> Advice ?
>
>  Snippet
>
>
>  window1->GetSurface( window1, &window_surface1 );
>         window_surface1->SetColor( window_surface1, 0xFF, 0x20, 0x20, 0xFF );
>         window_surface1->FillRectangle( window_surface1,
>                 0, 0, desc.width, desc.height );
>         {
>           int pitch;
>           void *data;
>           DFBRectangle rect = {0,-100,100,200};
>           IDirectFBSurface *sub;
>           window_surface1->GetSubSurface(window_surface1,&rect,&sub);
>           sub->Lock(sub,DSLF_WRITE,&data,&pitch);
>           printf(" SUB DATA =%p \n",data);
>           window_surface1->Lock(window_surface1,DSLF_WRITE,&data,&pitch);
>           printf(" WINDOW DATA =%p \n",data);
>         }
>
>
>
>
> Output
>
> SUB DATA =0xb6cc3008
>  WINDOW DATA =0xb6cc3008
>
>
> Mike
>

_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to