Hello,
I spotted this bug while trying to fix mouse pointer trails problem in Warlords Battlecry. All widths, heights and left/top coordinates are of DWORD type, so substracting them from each other always give positive numbers. Thus h and w are always >= 0, so DDERR_INVALIDRECT is returned only in a couple of boundary cases.
I just added explicit casting to int where needed. It didn't fix the mouse trails, but previously missing mouseover effect on icons at the main screen appeared, so I guess it is a change in the right direction :)
Patch attached.
I just added explicit casting to int where needed. It didn't fix the mouse trails, but previously missing mouseover effect on icons at the main screen appeared, so I guess it is a change in the right direction :)
While your patch is certainly OK, if 'ddesc.dwWidth-dstx' is lower than zero, it means that there is nothing to do (as the destination X coordinate is out of the screen). Same for the source rectangle.
So could you try rewriting your patch with something like that :
if (ddesc.dwWidth<=dstx) return DD_OK; (and same for Y and srcs).
And check if it gives you the same result as your previous patch. Maybe it's some added code, but well, it will be a bit cleaner IMHO.
Anyway, thanks for fixing bugs in the DDraw code, we certainly needs more contributors :-)
Lionel
On Monday 26 January 2004 22:27, Lionel Ulmer wrote:
While your patch is certainly OK, if 'ddesc.dwWidth-dstx' is lower than zero, it means that there is nothing to do (as the destination X coordinate is out of the screen). Same for the source rectangle.
Are you sure about this? Isn't INVALIDRECT returned in this case? I am asking these questions, because I could not find any documentation in MSDN explaining when is INVALIDRECT returned. Do you have any test results? Maybe I should write a test?
And check if it gives you the same result as your previous patch. Maybe it's some added code, but well, it will be a bit cleaner IMHO. Anyway, thanks for fixing bugs in the DDraw code, we certainly needs more contributors :-)
Thanks, I will look into this as soon as I find some free time. Currently I have more important work to do for a living, so Wine has to wait :/
Are you sure about this? Isn't INVALIDRECT returned in this case? I am asking these questions, because I could not find any documentation in MSDN explaining when is INVALIDRECT returned. Do you have any test results? Maybe I should write a test?
Well, MSDN usually does not document at all the border / failure cases... So best is to write a test program.
If you do not have the mean to do it, I may do it later this week (or on the plane on Thursday :-) ).
Lionel
On Wednesday 04 February 2004 23:15, Lionel Ulmer wrote:
If you do not have the mean to do it, I may do it later this week (or on the plane on Thursday :-) ).
I will be busy at least till Saturday, so if you would like to do it on a boring flight, go ahead :)