From bf6998672f02d12a9df99c99dd1b29dd30ed9efd Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Fri, 17 Dec 2021 15:02:21 +0800 Subject: [PATCH] tune the fix --- src/newgdi/gdi.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/newgdi/gdi.c b/src/newgdi/gdi.c index ca14b8a9..6e06417a 100644 --- a/src/newgdi/gdi.c +++ b/src/newgdi/gdi.c @@ -2506,10 +2506,6 @@ static BOOL dc_InitSubDC (HDC hdcDest, HDC hdc, int off_x, int off_y, /* should set after InitMemDC.*/ pdc->hwnd = pdc_parent->hwnd; - InitClipRgn (&pdc->lcrgn, &__mg_FreeClipRectList); - MAKE_REGION_INFINITE(&pdc->lcrgn); - InitClipRgn (&pdc->ecrgn, &__mg_FreeClipRectList); - CopyRegion (&pdc->lcrgn, &pdc_parent->lcrgn); CopyRegion (&pdc->ecrgn, &pdc_parent->ecrgn); IntersectClipRect (&pdc->ecrgn, &pdc->DevRC); @@ -2568,6 +2564,10 @@ HDC GUIAPI GetSubDC (HDC hdc, int off_x, int off_y, int width, int height) if (pdc == NULL) return HDC_INVALID; + InitClipRgn (&pdc->lcrgn, &__mg_FreeClipRectList); + MAKE_REGION_INFINITE(&pdc->lcrgn); + InitClipRgn (&pdc->ecrgn, &__mg_FreeClipRectList); + if (!dc_InitSubDC((HDC)pdc, hdc, off_x, off_y, width, height)) { pdc->bInUse = FALSE; return HDC_INVALID; @@ -2658,15 +2658,15 @@ HDC GUIAPI CreatePrivateSubDC (HDC hdc, int off_x, int off_y, if (!(pdc = malloc(sizeof(DC)))) return HDC_INVALID; - InitClipRgn (&pdc->lcrgn, &__mg_FreeClipRectList); - MAKE_REGION_INFINITE(&pdc->lcrgn); - InitClipRgn (&pdc->ecrgn, &__mg_FreeClipRectList); - pdc->bInUse = TRUE; pdc->DataType = TYPE_HDC; /* XXX: use the parent's type */ pdc->DCType = pdc_parent->DCType; + InitClipRgn (&pdc->lcrgn, &__mg_FreeClipRectList); + MAKE_REGION_INFINITE(&pdc->lcrgn); + InitClipRgn (&pdc->ecrgn, &__mg_FreeClipRectList); + if (!dc_InitSubDC ((HDC)pdc, hdc, off_x, off_y, width, height)) { free (pdc); return HDC_INVALID;