ddraw correctness fixes patch

Christian Costa titan.costa at wanadoo.fr
Fri Mar 18 16:33:28 CST 2005


Tony Lambregts wrote:

> 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

I think the problem Matthew was talking is how to remap surface pointers.

I sent something to Mattew but I forgot to cc wine-devel, sorry.

Basically it was :

depth = surface_desc.u4.ddpfPixelFormat.u1.dwRGBBitCount;
ddesc.lpSurface -= (lock_dst.left - lock_union.left)*(depth+7)/8 + 
ddesc.lPictch * (lock_dst.top - lock_union.top);
sdesc.lpSurface -= (lock_src.left - lock_union.left)*(depth+7)/8) + 
sdesc.lPictch * (lock_src.top - lock_union.top);

>
>
> 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);
> ....
>
You mean UnionRect. Don't you ? :-)

Bye,
Christian








More information about the wine-devel mailing list