From 1cb80f3aa0dae21dd8dbed615133fdbd801bb35d Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 30 Dec 2014 21:03:13 +0000 Subject: [PATCH] [WIN32K] - Fix definition of ROP_TO_ROP4 - Move some macros to intgdi.h - Fix coordinate space mismatch in IntGdiBitBltRgn and IntGdiFillRgn Fixes console window selection svn path=/trunk/; revision=65914 --- reactos/win32ss/gdi/ntgdi/bitblt.c | 38 +++++++++++++++++------------- reactos/win32ss/gdi/ntgdi/dibobj.c | 2 -- reactos/win32ss/gdi/ntgdi/intgdi.h | 5 ++++ 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/reactos/win32ss/gdi/ntgdi/bitblt.c b/reactos/win32ss/gdi/ntgdi/bitblt.c index 95afbf6d026..df8c753c48b 100644 --- a/reactos/win32ss/gdi/ntgdi/bitblt.c +++ b/reactos/win32ss/gdi/ntgdi/bitblt.c @@ -9,12 +9,6 @@ #include DBG_DEFAULT_CHANNEL(GdiBlt); -#define ROP_USES_SOURCE(Rop) (((((Rop) & 0xCC0000) >> 2) != ((Rop) & 0x330000)) || ((((Rop) & 0xCC000000) >> 2) != ((Rop) & 0x33000000))) -#define ROP_USES_MASK(Rop) (((Rop) & 0xFF000000) != (((Rop) & 0xff0000) << 8)) - -#define FIXUP_ROP(Rop) if(((Rop) & 0xFF000000) == 0) Rop = MAKEROP4((Rop), (Rop)) -#define ROP_TO_ROP4(Rop) ((Rop) >> 16) - BOOL APIENTRY NtGdiAlphaBlend( HDC hDCDest, @@ -1038,7 +1032,7 @@ IntGdiBitBltRgn( BOOL bResult; NT_ASSERT((pdc != NULL) && (prgn != NULL)); - /* Get the surface */ + /* Check if we have a surface */ if (pdc->dclevel.pSurface == NULL) { return TRUE; @@ -1052,19 +1046,28 @@ IntGdiBitBltRgn( } /* Transform given region into device coordinates */ - if (!REGION_LPTODP(pdc, prgnClip, prgn) || - !REGION_bOffsetRgn(prgnClip, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y)) + if (!REGION_LPTODP(pdc, prgnClip, prgn)) { REGION_Delete(prgnClip); return FALSE; } - /* Intersect with the system or RAO region */ + /* Intersect with the system or RAO region (these are (atm) without DC-origin) */ if (pdc->prgnRao) IntGdiCombineRgn(prgnClip, prgnClip, pdc->prgnRao, RGN_AND); else IntGdiCombineRgn(prgnClip, prgnClip, pdc->prgnVis, RGN_AND); + /* Now account for the DC-origin */ + if (!REGION_bOffsetRgn(prgnClip, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y)) + { + REGION_Delete(prgnClip); + return FALSE; + } + + /* Prepare the DC */ + DC_vPrepareDCsForBlit(pdc, &prgnClip->rdh.rcBound, NULL, NULL); + /* Initialize a clip object */ IntEngInitClipObj(&xcoClip); IntEngUpdateClipRegion(&xcoClip, @@ -1072,9 +1075,6 @@ IntGdiBitBltRgn( prgnClip->Buffer, &prgnClip->rdh.rcBound); - /* Prepare the DC */ - DC_vPrepareDCsForBlit(pdc, &prgnClip->rdh.rcBound, NULL, NULL); - /* Call the Eng or Drv function */ bResult = IntEngBitBlt(&pdc->dclevel.pSurface->SurfObj, NULL, @@ -1125,19 +1125,25 @@ IntGdiFillRgn( } /* Transform region into device coordinates */ - if (!REGION_LPTODP(pdc, prgnClip, prgn) || - !REGION_bOffsetRgn(prgnClip, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y)) + if (!REGION_LPTODP(pdc, prgnClip, prgn)) { REGION_Delete(prgnClip); return FALSE; } - /* Intersect with the system or RAO region */ + /* Intersect with the system or RAO region (these are (atm) without DC-origin) */ if (pdc->prgnRao) IntGdiCombineRgn(prgnClip, prgnClip, pdc->prgnRao, RGN_AND); else IntGdiCombineRgn(prgnClip, prgnClip, pdc->prgnVis, RGN_AND); + /* Now account for the DC-origin */ + if (!REGION_bOffsetRgn(prgnClip, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y)) + { + REGION_Delete(prgnClip); + return FALSE; + } + IntEngInitClipObj(&xcoClip); IntEngUpdateClipRegion(&xcoClip, prgnClip->rdh.nCount, diff --git a/reactos/win32ss/gdi/ntgdi/dibobj.c b/reactos/win32ss/gdi/ntgdi/dibobj.c index faa7f0c937f..77250a9ab99 100644 --- a/reactos/win32ss/gdi/ntgdi/dibobj.c +++ b/reactos/win32ss/gdi/ntgdi/dibobj.c @@ -1109,8 +1109,6 @@ cleanup: } -#define ROP_TO_ROP4(Rop) ((Rop) >> 16) - W32KAPI INT APIENTRY diff --git a/reactos/win32ss/gdi/ntgdi/intgdi.h b/reactos/win32ss/gdi/ntgdi/intgdi.h index 6971510be01..81ae460177c 100644 --- a/reactos/win32ss/gdi/ntgdi/intgdi.h +++ b/reactos/win32ss/gdi/ntgdi/intgdi.h @@ -1,5 +1,10 @@ #pragma once +#define ROP_USES_SOURCE(Rop) (((((Rop) & 0xCC0000) >> 2) != ((Rop) & 0x330000)) || ((((Rop) & 0xCC000000) >> 2) != ((Rop) & 0x33000000))) +#define ROP_USES_MASK(Rop) (((Rop) & 0xFF000000) != (((Rop) & 0xff0000) << 8)) +#define FIXUP_ROP(Rop) if(((Rop) & 0xFF000000) == 0) Rop = MAKEROP4((Rop), (Rop)) +#define ROP_TO_ROP4(Rop) (((Rop) >> 8) & 0xFF00) | ((Rop) >> 16) + /* Brush functions */ extern HDC hSystemBM;