From 625f5ea12f732e98973dc2bc0c3fcfb57565ba37 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 15 Apr 2010 14:11:07 -0500 Subject: [PATCH 1/6] gdiplus: Use a helper function to draw image data from bitmaps in software. This will make it possible to use the same codepath for non-bitmap graphics objects and to create a software implementation for other drawing operations. --- dlls/gdiplus/graphics.c | 60 +++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 53 insertions(+), 7 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 7510fa0..d589121 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 { -- 1.6.3.3