From f696e431adcc55a72b3b3a02233ae2d01750e0ed Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Mon, 19 Sep 2016 15:07:02 -0500 Subject: [PATCH] gdiplus: Add clipping to GdipDrawImage. Signed-off-by: Vincent Povirk Signed-off-by: Alexandre Julliard --- dlls/gdiplus/graphics.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 894503e0434..076ed81d12a 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);