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>
This commit is contained in:
Damjan Jovanovic 2019-12-13 05:16:53 +02:00 committed by Alexandre Julliard
parent 0bfb3826ad
commit a16a4d9757
2 changed files with 17 additions and 9 deletions

View File

@ -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));
}
}
}

View File

@ -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);