gdiplus: Use StretchBlt instead of GdiAlphaBlend if device doesn't support alpha blending.

Dmitry Timoshkov dmitry на baikal.ru
Вт Мар 6 12:53:49 MSK 2012


Should fix #5892.

---
 dlls/gdiplus/graphics.c |   25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 50d2f7c..92c24cf 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -217,7 +217,6 @@ static GpStatus alpha_blend_pixels(GpGraphics *graphics, INT dst_x, INT dst_y,
         HBITMAP hbitmap, old_hbm=NULL;
         BITMAPINFOHEADER bih;
         BYTE *temp_bits;
-        BLENDFUNCTION bf;
 
         hdc = CreateCompatibleDC(0);
 
@@ -241,13 +240,25 @@ static GpStatus alpha_blend_pixels(GpGraphics *graphics, INT dst_x, INT dst_y,
 
         old_hbm = SelectObject(hdc, hbitmap);
 
-        bf.BlendOp = AC_SRC_OVER;
-        bf.BlendFlags = 0;
-        bf.SourceConstantAlpha = 255;
-        bf.AlphaFormat = AC_SRC_ALPHA;
+        if (GetDeviceCaps(graphics->hdc, SHADEBLENDCAPS) == SB_NONE)
+        {
+            TRACE("alpha blending not supported by device, fallback to StretchBlt\n");
 
-        GdiAlphaBlend(graphics->hdc, dst_x, dst_y, src_width, src_height,
-            hdc, 0, 0, src_width, src_height, bf);
+            StretchBlt(graphics->hdc, dst_x, dst_y, src_width, src_height,
+                       hdc, 0, 0, src_width, src_height, SRCCOPY);
+        }
+        else
+        {
+            BLENDFUNCTION bf;
+
+            bf.BlendOp = AC_SRC_OVER;
+            bf.BlendFlags = 0;
+            bf.SourceConstantAlpha = 255;
+            bf.AlphaFormat = AC_SRC_ALPHA;
+
+            GdiAlphaBlend(graphics->hdc, dst_x, dst_y, src_width, src_height,
+                          hdc, 0, 0, src_width, src_height, bf);
+        }
 
         SelectObject(hdc, old_hbm);
         DeleteDC(hdc);
-- 
1.7.9.2


--Multipart=_Tue__6_Mar_2012_23_06_30_+0800_8y5CoBYtinXDh=Ix--


Подробная информация о списке рассылки Wine-patches