diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 7b3f64fd2da..6a1dc10d600 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -173,6 +173,35 @@ static void transform_and_round_points(GpGraphics *graphics, POINT *pti, } } +/* Draw non-premultiplied ARGB data to the given graphics object */ +static GpStatus alpha_blend_pixels(GpGraphics *graphics, INT dst_x, INT dst_y, + const BYTE *src, INT src_width, INT src_height, INT src_stride) +{ + if (graphics->image && graphics->image->type == ImageTypeBitmap) + { + GpBitmap *dst_bitmap = (GpBitmap*)graphics->image; + INT x, y; + + for (x=0; x= src_area.right || src_y < src_area.top || src_y >= src_area.bottom) /* FIXME: Use wrapmode */ - continue; - - GdipBitmapGetPixel(bitmap, src_x, src_y, &src_color); - GdipBitmapGetPixel((GpBitmap*)graphics->image, x, y, &dst_color); - GdipBitmapSetPixel((GpBitmap*)graphics->image, x, y, color_over(dst_color, src_color)); + *src_color = 0; + else + GdipBitmapGetPixel(bitmap, src_x, src_y, src_color); } } GdipDeleteMatrix(dst_to_src); + + stat = alpha_blend_pixels(graphics, dst_area.left, dst_area.top, + data, dst_area.right - dst_area.left, dst_area.bottom - dst_area.top, stride); + + GdipFree(data); + + return stat; } else {