From d6f9be8c530a08eb1d30ef5e86af80006d8c1139 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 10 Mar 2011 15:58:22 -0600 Subject: [PATCH 2/9] gdiplus: Call GdiAlphaBlend only once per GdipFillRegion call. For the moment, alpha_blend_pixels is slow for HDC's, as each call results in a call to GdiAlphaBlend (and maybe a round-trip due to using a DIB). So this visibly speeds up GdipFillRegion for non-rectangular regions. --- dlls/gdiplus/graphics.c | 93 ++++++++++++++++++++++++++++++++++++----------- 1 files changed, 72 insertions(+), 21 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 4d059f8..83e0f24 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -3856,39 +3856,90 @@ static GpStatus SOFTWARE_GdipFillRegion(GpGraphics *graphics, GpBrush *brush, if (stat == Ok) { - UINT max_size=0; - - for (i=0; iimage) { - UINT size = scans[i].Width * scans[i].Height; + /* If we have to go through gdi32, use as few alpha blends as possible. */ + INT min_x, min_y, max_x, max_y; + UINT data_width, data_height; - if (size > max_size) - max_size = size; - } + min_x = scans[0].X; + min_y = scans[0].Y; + max_x = scans[0].X+scans[0].Width; + max_y = scans[0].Y+scans[0].Height; - pixel_data = GdipAlloc(sizeof(*pixel_data) * max_size); - if (!pixel_data) - stat = OutOfMemory; + for (i=1; i max_size) + max_size = size; + } + + pixel_data = GdipAlloc(sizeof(*pixel_data) * max_size); + if (!pixel_data) + stat = OutOfMemory; + + if (stat == Ok) + { + for (i=0; i