Matthew Mastracci wrote:
Thanks for the review - comments inline.
Christian Costa wrote:
The new locking mechanism is wrong. DDLOCK_xxx are just used for optimization.
The thing to do during the blit should be something like that :
sdesc.dwSize = sizeof(sdesc); ddesc.dwSize = sizeof(ddesc); if (src == NULL) IDirectDrawSurface7_Lock(iface, &lock_dst, &ddesc, DDLOCK_WRITEONLY, 0); else if (src == iface) { RECT lock_union = < rect that just contains lock_dst and lock_src >; IDirectDrawSurface7_Lock(iface, &lock_union, &ddesc, 0, 0); sdesc = ddesc;
I think here that sdesc and ddesc surface pointers should be remapped according to lock_src and lock_dest.
The above logic makes sense - I originally tried to solve it this way, but ended up failing because of the sdesc and ddesc mapping issue. Any idea how to do this cleanly?
I think what will work is IntersectRect() from windows/rect.c
IntersectRect( LPRECT dest, const RECT *src1, const RECT *src2)
Something like the following perhaps?
RECT lock_union
if IntersectRect(&lockunion, &sdesc, &ddesc) IDirectDrawSurface7_Lock(iface, &lock_union, &ddesc, 0, 0); ....
--
Tony Lambregts