Vincent Povirk : gdiplus: Add clipping to GdipDrawImage.

Alexandre Julliard julliard at winehq.org
Tue Sep 20 10:45:00 CDT 2016


Module: wine
Branch: master
Commit: f696e431adcc55a72b3b3a02233ae2d01750e0ed
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f696e431adcc55a72b3b3a02233ae2d01750e0ed

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Mon Sep 19 15:07:02 2016 -0500

gdiplus: Add clipping to GdipDrawImage.

Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdiplus/graphics.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 894503e..076ed81 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -3083,6 +3083,8 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
             HDC hdc;
             BOOL temp_hdc = FALSE, temp_bitmap = FALSE;
             HBITMAP hbitmap, old_hbm=NULL;
+            HRGN hrgn;
+            INT save_state;
 
             if (!(bitmap->format == PixelFormat16bppRGB555 ||
                   bitmap->format == PixelFormat24bppRGB ||
@@ -3143,6 +3145,16 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
                 old_hbm = SelectObject(hdc, hbitmap);
             }
 
+            save_state = SaveDC(graphics->hdc);
+
+            stat = get_clip_hrgn(graphics, &hrgn);
+
+            if (stat == Ok && hrgn)
+            {
+                ExtSelectClipRgn(graphics->hdc, hrgn, RGN_AND);
+                DeleteObject(hrgn);
+            }
+
             if (bitmap->format & (PixelFormatAlpha|PixelFormatPAlpha))
             {
                 gdi_alpha_blend(graphics, pti[0].x, pti[0].y, pti[1].x - pti[0].x, pti[2].y - pti[0].y,
@@ -3154,6 +3166,8 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
                     hdc, srcx, srcy, srcwidth, srcheight, SRCCOPY);
             }
 
+            RestoreDC(graphics->hdc, save_state);
+
             if (temp_hdc)
             {
                 SelectObject(hdc, old_hbm);




More information about the wine-cvs mailing list