Author: tkreuzer
Date: Tue Dec 30 21:03:13 2014
New Revision: 65914

URL: http://svn.reactos.org/svn/reactos?rev=65914&view=rev
Log:
[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

Modified:
    trunk/reactos/win32ss/gdi/ntgdi/bitblt.c
    trunk/reactos/win32ss/gdi/ntgdi/dibobj.c
    trunk/reactos/win32ss/gdi/ntgdi/intgdi.h

Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c?rev=65914&r1=65913&r2=65914&view=diff
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c    [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c    [iso-8859-1] Tue Dec 30 
21:03:13 2014
@@ -8,12 +8,6 @@
 
 #include <win32k.h>
 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(
@@ -1038,7 +1032,7 @@
     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,18 +1046,27 @@
     }
 
     /* 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);
@@ -1071,9 +1074,6 @@
                            prgnClip->rdh.nCount,
                            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,
@@ -1125,18 +1125,24 @@
     }
 
     /* 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,

Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dibobj.c?rev=65914&r1=65913&r2=65914&view=diff
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/dibobj.c    [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/dibobj.c    [iso-8859-1] Tue Dec 30 
21:03:13 2014
@@ -1109,8 +1109,6 @@
 }
 
 
-#define ROP_TO_ROP4(Rop) ((Rop) >> 16)
-
 W32KAPI
 INT
 APIENTRY

Modified: trunk/reactos/win32ss/gdi/ntgdi/intgdi.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/intgdi.h?rev=65914&r1=65913&r2=65914&view=diff
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/intgdi.h    [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/intgdi.h    [iso-8859-1] Tue Dec 30 
21:03:13 2014
@@ -1,4 +1,9 @@
 #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 */
 


Reply via email to