Re: gdi32: StretchDIBits seems to use the wrong picture offset

2008-07-21 Thread Lei Zhang
On Sat, Jul 19, 2008 at 11:06 AM, Mathias Kosch [EMAIL PROTECTED] wrote:
 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.

You can attach the screenshots to the bug's entry in bugzilla.

Please send patches to wine-patches, not wine-devel.




gdi32: StretchDIBits seems to use the wrong picture offset

2008-07-19 Thread Mathias Kosch
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.
-- 
Mathias Kosch [EMAIL PROTECTED] | http://www.mkosch.de/
RSA Public Key: http://www.mkosch.de/pubkey

IT-Nachrichten auf heise online: http://www.heise.de/

modified-StretchDIBits.c
Description: Binary data
StretchDIBits(hdc=0x2a8, xDst=0, yDst=40, widthDst=1276, heightDst=850, xSrc=0, 
ySrc=0, widthSrc=1276, heightSrc=850, bits=0x6490030, info=0x33d95c, wUsage=0, 
dwRop=08CC0020)
info-bmiHeader.biWidth=1280
info-bmiHeader.biHeight=-1024
(1)- SetDIBits(hdc=0x22b0, hbitmap=0x22bc, startscan=0, lines=4294966272, 
bits=0x6490030, info=0x33d95c, coloruse=0)
abs(height)=1024
heightSrc=850
ySrc=0
(2)- StretchBlt(hdcDst=0x2a8, xDst=0, yDst=40, widthDst=1276, heightDst=850, 
hdcSrc=0x22b0, xSrc=0, ySrc=174, widthSrc=1276, heightSrc=850, dwRop=08CC0020)



Re: gdi32: StretchDIBits seems to use the wrong picture offset

2008-07-19 Thread Mathias Kosch
 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.

-- 
Mathias Kosch [EMAIL PROTECTED] | http://www.mkosch.de/
RSA Public Key: http://www.mkosch.de/pubkey

Internet-Links ganz kurz: http://www.kuerzer.de/