Module: wine Branch: master Commit: a16a4d97570613a8139a9a06164032324438367b URL: https://source.winehq.org/git/wine.git/?a=commit;h=a16a4d97570613a8139a9a061...
Author: Damjan Jovanovic damjan.jov@gmail.com Date: Fri Dec 13 05:16:53 2019 +0200
gdiplus: Start implementing CompositingModeSourceCopy.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30506 Signed-off-by: Damjan Jovanovic damjan.jov@gmail.com Signed-off-by: Vincent Povirk vincent@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/gdiplus/graphics.c | 22 +++++++++++++++------- dlls/gdiplus/tests/image.c | 4 ++-- 2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 3c83278a4b..e0a013896f 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -372,6 +372,9 @@ static GpStatus alpha_blend_bmp_pixels(GpGraphics *graphics, INT dst_x, INT dst_ { GpBitmap *dst_bitmap = (GpBitmap*)graphics->image; INT x, y; + CompositingMode comp_mode; + + GdipGetCompositingMode(graphics, &comp_mode);
for (y=0; y<src_height; y++) { @@ -380,14 +383,19 @@ static GpStatus alpha_blend_bmp_pixels(GpGraphics *graphics, INT dst_x, INT dst_ ARGB dst_color, src_color; src_color = ((ARGB*)(src + src_stride * y))[x];
- if (!(src_color & 0xff000000)) - continue; - - GdipBitmapGetPixel(dst_bitmap, x+dst_x, y+dst_y, &dst_color); - if (fmt & PixelFormatPAlpha) - GdipBitmapSetPixel(dst_bitmap, x+dst_x, y+dst_y, color_over_fgpremult(dst_color, src_color)); + if (comp_mode == CompositingModeSourceCopy) + GdipBitmapSetPixel(dst_bitmap, x+dst_x, y+dst_y, src_color); else - GdipBitmapSetPixel(dst_bitmap, x+dst_x, y+dst_y, color_over(dst_color, src_color)); + { + if (!(src_color & 0xff000000)) + continue; + + GdipBitmapGetPixel(dst_bitmap, x+dst_x, y+dst_y, &dst_color); + if (fmt & PixelFormatPAlpha) + GdipBitmapSetPixel(dst_bitmap, x+dst_x, y+dst_y, color_over_fgpremult(dst_color, src_color)); + else + GdipBitmapSetPixel(dst_bitmap, x+dst_x, y+dst_y, color_over(dst_color, src_color)); + } } }
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 60591b0aca..74c471e9ac 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -4205,9 +4205,9 @@ static void test_DrawImage_SourceCopy(void) status = GdipDrawImageI(graphics, u2.image, 0, 0); expect(Ok, status);
- todo_wine expect(0, dst_pixels[0]); + expect(0, dst_pixels[0]); expect(0xffff0000, dst_pixels[1]); - todo_wine expect(0, dst_pixels[2]); + expect(0, dst_pixels[2]); todo_wine expect(0, dst_pixels[3]);
status = GdipDeleteGraphics(graphics);