Currently I'm trying to fix Bug#13344. I figured out that the problems seems to be caused by the function "StretchDIBits" inside "dlls/gdi32/dib.c".
When I run "Digital Photo Professional 3.4.1.1" and open images in the editor window in "fit to window" mode all images are shifted to top so that I cannot totally see them. I provided a screenshot as attachment for you to see. The picture was colored to purple to reduce bandwidth. The dimensions of the visible image are 1276 x 850 pixels. The picture is shifted upwards by exactly 174 pixels, so a black bar appears at the bottom.
I modified my local copy of "dib.c" (modifications as attachment) to output its parameters. The produced (extract of the) output is attached as "output.txt". The function "StretchDIBits" is called correctly. It shall display a portion of the bitmap at position (0, 40) of dimensions (1276, 850). This function produces two calls to "StretchBlt". (In my case only the second one is called.) The parameters it passes to "StretchBlt" appear to be wrong because (in the second call) "ySrc" is set to 174 which explains the pixel shift. If I adjust "ySrc" to 0 all images are displayed correctly.
I looked at the code of "SetDIBits". It seems that it doesn't make any difference between bottom-up or top-down DIBs except that the pixel data is mirrored in y direction. I assume Windows does it the same way, but didn't verify it. However "StretchDIBits" wants to differentiate between the two cases by setting the y offset to "abs(height)-heightSrc-ySrc". I think only "ySrc" should be used as y offset. However since I'm not absolutely sure I would like to ask someone with a little more experience.
By the way, I recognized another problem. The code also contains two calls to "SetDIBits" with parameter "height" for "UINT lines". However "height" may be negative. When I'm able to produce a patch for Bug#13344 I will fix this as well.
I provided a screenshot as attachment for you to see.
I wasn't able to send it to this mailing list. I think this is by intention. So please ask me if you want to see.
On Sat, Jul 19, 2008 at 11:06 AM, Mathias Kosch info@mkosch.de wrote:
You can attach the screenshots to the bug's entry in bugzilla.
Please send patches to wine-patches, not wine-devel.