[PATCH v2 1/2] gdiplus: start implementing CompositingModeSourceCopy

Damjan Jovanovic damjan.jov at gmail.com
Thu Dec 12 21:16:53 CST 2019


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30506

Signed-off-by: Damjan Jovanovic <damjan.jov at gmail.com>
---
 dlls/gdiplus/graphics.c    | 22 +++++++++++++++-------
 dlls/gdiplus/tests/image.c |  4 ++--
 2 files changed, 17 insertions(+), 9 deletions(-)
-------------- next part --------------
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);


More information about the wine-devel mailing list