Module: wine Branch: master Commit: ed3cd9b35f095c5258ad48b5283e1bbd84646046 URL: https://gitlab.winehq.org/wine/wine/-/commit/ed3cd9b35f095c5258ad48b5283e1bb...
Author: Esme Povirk esme@codeweavers.com Date: Thu May 2 14:25:33 2024 -0500
gdiplus: Bracket HDC use in alpha_blend_pixels_hrgn.
---
dlls/gdiplus/graphics.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 3c00eddddf4..78e3b07222d 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -591,28 +591,39 @@ static GpStatus alpha_blend_pixels_hrgn(GpGraphics *graphics, INT dst_x, INT dst } else { + HDC hdc; HRGN hrgn; int save;
+ stat = gdi_dc_acquire(graphics, &hdc); + + if (stat != Ok) + return stat; + stat = get_clip_hrgn(graphics, &hrgn);
if (stat != Ok) + { + gdi_dc_release(graphics, hdc); return stat; + }
- save = SaveDC(graphics->hdc); + save = SaveDC(hdc);
- ExtSelectClipRgn(graphics->hdc, hrgn, RGN_COPY); + ExtSelectClipRgn(hdc, hrgn, RGN_COPY);
if (hregion) - ExtSelectClipRgn(graphics->hdc, hregion, RGN_AND); + ExtSelectClipRgn(hdc, hregion, RGN_AND);
stat = alpha_blend_hdc_pixels(graphics, dst_x, dst_y, src, src_width, src_height, src_stride, fmt);
- RestoreDC(graphics->hdc, save); + RestoreDC(hdc, save);
DeleteObject(hrgn);
+ gdi_dc_release(graphics, hdc); + return stat; } }