[ros-diffs] [fireball] 42286: - RosGdiSelectBitmap: In case it gets an unknown bitmap, create a stock bitmap and select it. But warning is still printed for further investigation. - RosGdiSelectBrush: Nullify selected brush pointer after freeing last selected brush. It helps tracking selection failures. - RosGdiSelectBrush: Create a NULL brush if requested. - RosGdiSelectPen: Don't free previously selected brush if selecting new pen fails.

fireball at svn.reactos.org fireball at svn.reactos.org
Wed Jul 29 15:40:32 CEST 2009


Author: fireball
Date: Wed Jul 29 15:40:32 2009
New Revision: 42286

URL: http://svn.reactos.org/svn/reactos?rev=42286&view=rev
Log:
- RosGdiSelectBitmap: In case it gets an unknown bitmap, create a stock bitmap and select it. But warning is still printed for further investigation.
- RosGdiSelectBrush: Nullify selected brush pointer after freeing last selected brush. It helps tracking selection failures.
- RosGdiSelectBrush: Create a NULL brush if requested.
- RosGdiSelectPen: Don't free previously selected brush if selecting new pen fails.

Modified:
    branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c

Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c?rev=42286&r1=42285&r2=42286&view=diff
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] Wed Jul 29 15:40:32 2009
@@ -184,12 +184,16 @@
     PDC pDC;
     PSURFACE pSurface;
     HGDIOBJ hBmpKern;
+    SIZEL slSize;
 
     hBmpKern = GDI_MapUserHandle(hbitmap);
     if (!hBmpKern)
     {
         DPRINT1("Trying to select an unknown bitmap %x to the DC %x!\n", hbitmap, physDev);
-        return;
+
+        /* It probably is a stock bitmap, so select it */
+        slSize.cx = 1; slSize.cy = 1;
+        hBmpKern = GreCreateBitmap(slSize, 1, 1, 0, NULL);
     }
 
     /* Get a pointer to the DC and the bitmap*/
@@ -222,13 +226,18 @@
     DPRINT("RosGdiSelectBrush(): dc %x, brush style %x, brush color %x\n", physDev, pLogBrush->lbStyle, pLogBrush->lbColor);
 
     /* Free previous brush */
-    if (pDC->pFillBrush) GreFreeBrush(pDC->pFillBrush);
+    if (pDC->pFillBrush)
+    {
+        GreFreeBrush(pDC->pFillBrush);
+        pDC->pFillBrush = NULL;
+    }
 
     /* Create the brush */
     switch(pLogBrush->lbStyle)
     {
     case BS_NULL:
         DPRINT("BS_NULL\n" );
+        pDC->pFillBrush = GreCreateNullBrush();
         break;
 
     case BS_SOLID:
@@ -278,14 +287,16 @@
 
     DPRINT("RosGdiSelectPen(): dc %x, pen style %x, pen color %x\n", physDev, pLogPen->lopnStyle, pLogPen->lopnColor);
 
+    if (pExtLogPen)
+    {
+        DPRINT1("Ext pens aren't supported yet!");
+        /* Release the object */
+        GDI_ReleaseObj(physDev);
+        return;
+    }
+
     /* Free previous brush */
     if (pDC->pLineBrush) GreFreeBrush(pDC->pLineBrush);
-
-    if (pExtLogPen)
-    {
-        DPRINT1("Ext pens aren't supported yet!");
-        return;
-    }
 
     /* Create the pen */
     pDC->pLineBrush =




More information about the Ros-diffs mailing list