[ros-diffs] [tkreuzer] 56428: [WIN32K] Fix NtGdiPatBlt: ROPs with a source are not allowed, the background ROP is simply ignored.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Thu Apr 26 09:42:47 UTC 2012


Author: tkreuzer
Date: Thu Apr 26 09:42:46 2012
New Revision: 56428

URL: http://svn.reactos.org/svn/reactos?rev=56428&view=rev
Log:
[WIN32K]
Fix NtGdiPatBlt: ROPs with a source are not allowed, the background ROP is simply ignored.

Modified:
    trunk/reactos/win32ss/gdi/ntgdi/bitblt.c

Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c?rev=56428&r1=56427&r2=56428&view=diff
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Thu Apr 26 09:42:46 2012
@@ -866,53 +866,60 @@
     return TRUE;
 }
 
-BOOL APIENTRY
+BOOL
+APIENTRY
 NtGdiPatBlt(
-    HDC hDC,
-    INT XLeft,
-    INT YLeft,
-    INT Width,
-    INT Height,
-    DWORD ROP)
-{
-    DC *dc;
-    PDC_ATTR pdcattr;
-    BOOL ret;
-
-    BOOL UsesSource = ROP_USES_SOURCE(ROP);
-    if (UsesSource)
-    {
-        /* In this case we call on GdiMaskBlt */
-        return NtGdiMaskBlt(hDC, XLeft, YLeft, Width, Height, 0,0,0,0,0,0,ROP,0);
-    }
-
-    dc = DC_LockDc(hDC);
-    if (dc == NULL)
+    _In_ HDC hdcDest,
+    _In_ INT x,
+    _In_ INT y,
+    _In_ INT cx,
+    _In_ INT cy,
+    _In_ DWORD rop4)
+{
+    BOOL bResult;
+    PDC pdc;
+
+    /* Mask away everything except foreground rop index */
+    rop4 = rop4 & 0x00FF0000;
+    rop4 |= rop4 << 8;
+
+    /* Check if the rop uses a source */
+    if (ROP_USES_SOURCE(rop4))
+    {
+        /* This is not possible */
+        return 0;
+    }
+
+    /* Lock the DC */
+    pdc = DC_LockDc(hdcDest);
+    if (pdc == NULL)
     {
         EngSetLastError(ERROR_INVALID_HANDLE);
         return FALSE;
     }
-    if (dc->dctype == DC_TYPE_INFO)
-    {
-        DC_UnlockDc(dc);
-        DPRINT1("NtGdiPatBlt on info DC!\n");
-        /* Yes, Windows really returns TRUE in this case */
+
+    /* Check if the DC has no surface (empty mem or info DC) */
+    if (pdc->dclevel.pSurface == NULL)
+    {
+        /* Nothing to do, Windows returns TRUE! */
+        DC_UnlockDc(pdc);
         return TRUE;
     }
 
-    pdcattr = dc->pdcattr;
-
-    if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
-        DC_vUpdateFillBrush(dc);
-
-    ret = IntPatBlt(dc, XLeft, YLeft, Width, Height, ROP, &dc->eboFill);
-
-    DC_UnlockDc(dc);
-
-    return ret;
-}
-
-BOOL APIENTRY
+    /* Update the fill brush, if neccessary */
+    if (pdc->pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
+        DC_vUpdateFillBrush(pdc);
+
+    /* Call the internal function */
+    bResult = IntPatBlt(pdc, x, y, cx, cy, rop4, &pdc->eboFill);
+
+    /* Unlock the DC and return the result */
+    DC_UnlockDc(pdc);
+    return bResult;
+}
+
+BOOL
+APIENTRY
 NtGdiPolyPatBlt(
     HDC hDC,
     DWORD dwRop,




More information about the Ros-diffs mailing list