Commit f696e431 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Add clipping to GdipDrawImage.

parent c6afa50d
...@@ -3083,6 +3083,8 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image ...@@ -3083,6 +3083,8 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
HDC hdc; HDC hdc;
BOOL temp_hdc = FALSE, temp_bitmap = FALSE; BOOL temp_hdc = FALSE, temp_bitmap = FALSE;
HBITMAP hbitmap, old_hbm=NULL; HBITMAP hbitmap, old_hbm=NULL;
HRGN hrgn;
INT save_state;
if (!(bitmap->format == PixelFormat16bppRGB555 || if (!(bitmap->format == PixelFormat16bppRGB555 ||
bitmap->format == PixelFormat24bppRGB || bitmap->format == PixelFormat24bppRGB ||
...@@ -3143,6 +3145,16 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image ...@@ -3143,6 +3145,16 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
old_hbm = SelectObject(hdc, hbitmap); 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)) 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, 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 ...@@ -3154,6 +3166,8 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
hdc, srcx, srcy, srcwidth, srcheight, SRCCOPY); hdc, srcx, srcy, srcwidth, srcheight, SRCCOPY);
} }
RestoreDC(graphics->hdc, save_state);
if (temp_hdc) if (temp_hdc)
{ {
SelectObject(hdc, old_hbm); SelectObject(hdc, old_hbm);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment