gdiplus: When copying an image do not round pixel positions up.

Vincent Povirk madewokherd at
Mon Aug 27 21:27:03 CDT 2012

>> I just did, and the behavior, though it looks wrong, is the same
>> between builtin and native - the image is shifted by 1/2 pixel so that
>> it's cut off at the upper-left and we have extra transparent space at
>> the lower-right.
> With native gdiplus scenario described earlier works just fine for me,
> while with built-in there are black borders on bottom/right.

You should be getting transparent borders on the bottom/right.

This probably means you're using a surface that's not capable of alpha
blending, and in that situation gdi_alpha_blend currently draws fully
transparent pixels as black when it shouldn't. I'm pretty sure I
mentioned that as a problem earlier, around the time you introduced

If you compare the size of the image drawn between native/builtin (not
counting the border, which native draws as transparent, as does
builtin under normal circumstances), I think you'll find that it
currently matches and your patch changes it. If you didn't notice,
you're probably not enlarging the image enough.

Since GdipDrawImage doesn't accept a source rectangle, and those extra
pixels are supposed to be transparent, you could probably have
GdipDrawImage subtract 0.5 from your image width and height. That
should solve your problem in this limited case without fixing
gdi_alpha_blend or introducing a bug.

More information about the wine-devel mailing list