[ros-diffs] [fireball] 33418: - Get rid of duplicated (and different) NB_LAST_STOCK definitions in gdi32 and win32k, now it's defined to 22 (19 being a last public stock object, other 2 are internal). - Move a DEFAULT_BITMAP definiton from gdi32 into ntgdityp.h (not the best place, but could be moved to a better one later), and assign it a number 21, which it is on Windows XP (tested with a win32kntest framework, tests are committed). - Fix CreateBitmap to return a 1x1 stock bitmap object if the requested Width and Height are 0. - All of this work is based on Magnus Olsen's patches and Wine.

fireball at svn.reactos.org fireball at svn.reactos.org
Sat May 10 21:03:58 CEST 2008


Author: fireball
Date: Sat May 10 14:03:58 2008
New Revision: 33418

URL: http://svn.reactos.org/svn/reactos?rev=33418&view=rev
Log:
- Get rid of duplicated (and different) NB_LAST_STOCK definitions in gdi32 and win32k, now it's defined to 22 (19 being a last public stock object, other 2 are internal).
- Move a DEFAULT_BITMAP definiton from gdi32 into ntgdityp.h (not the best place, but could be moved to a better one later), and assign it a number 21, which it is on Windows XP (tested with a win32kntest framework, tests are committed).
- Fix CreateBitmap to return a 1x1 stock bitmap object if the requested Width and Height are 0.
- All of this work is based on Magnus Olsen's patches and Wine.

Modified:
    trunk/reactos/dll/win32/gdi32/include/gdi32p.h
    trunk/reactos/dll/win32/gdi32/misc/stubs.c
    trunk/reactos/include/reactos/win32k/ntgdityp.h
    trunk/reactos/subsystems/win32/win32k/include/object.h
    trunk/reactos/subsystems/win32/win32k/objects/stockobj.c

Modified: trunk/reactos/dll/win32/gdi32/include/gdi32p.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/include/gdi32p.h?rev=33418&r1=33417&r2=33418&view=diff
==============================================================================
--- trunk/reactos/dll/win32/gdi32/include/gdi32p.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/include/gdi32p.h [iso-8859-1] Sat May 10 14:03:58 2008
@@ -29,9 +29,6 @@
 
 #define METAFILE_MEMORY 1
 #define METAFILE_DISK   2
-
-#define DEFAULT_BITMAP (STOCK_LAST+1)
-#define NB_STOCK_OBJECTS (STOCK_LAST+2)
 
 /* TYPES *********************************************************************/
 

Modified: trunk/reactos/dll/win32/gdi32/misc/stubs.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/stubs.c?rev=33418&r1=33417&r2=33418&view=diff
==============================================================================
--- trunk/reactos/dll/win32/gdi32/misc/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/misc/stubs.c [iso-8859-1] Sat May 10 14:03:58 2008
@@ -1936,7 +1936,15 @@
              PCVOID pUnsafeBits)
 {
     /* FIXME some part should be done in user mode */
-    return NtGdiCreateBitmap(Width, Height, Planes, BitsPixel, (LPBYTE) pUnsafeBits);
+    if (Width && Height)
+    {
+        return NtGdiCreateBitmap(Width, Height, Planes, BitsPixel, (LPBYTE) pUnsafeBits);
+    }
+    else
+    {
+        /* Return 1x1 bitmap */
+        return GetStockObject(DEFAULT_BITMAP);
+    }
 }
 
 /*

Modified: trunk/reactos/include/reactos/win32k/ntgdityp.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntgdityp.h?rev=33418&r1=33417&r2=33418&view=diff
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntgdityp.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntgdityp.h [iso-8859-1] Sat May 10 14:03:58 2008
@@ -159,10 +159,12 @@
 typedef DWORD FULLSCREENCONTROL;
 typedef DWORD LFTYPE;
 
-/* NOTE DC_BITMAP or the value are not documented in MSDN or ms header 
- * it return a 1x1 1Bpp Bitmap in all case from GetStockObject
- */
-#define DC_BITMAP 21
+/* Public LAST_STOCK = 19, plus 2 more internal entries */
+#define NB_STOCK_OBJECTS 22
+
+/* extra stock object: default 1x1 bitmap for memory DCs */
+#define DEFAULT_BITMAP (21)
+
 
 /* DEFINES *******************************************************************/
 

Modified: trunk/reactos/subsystems/win32/win32k/include/object.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/object.h?rev=33418&r1=33417&r2=33418&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/object.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/object.h [iso-8859-1] Sat May 10 14:03:58 2008
@@ -7,11 +7,6 @@
 
 #define FIRST_USER_HANDLE 0x0020  /* first possible value for low word of user handle */
 #define LAST_USER_HANDLE  0xffef  /* last possible value for low word of user handle */
-
-/* Comments from reserve two extra entry for the stock default bitmap  this is what Windows does too 
- * and verify if it is true it is not. in XP/2003 it is 22 stockobjects for each bitmap
- */
-#define PRV_STOCK_LAST 22
 
 #define USER_HEADER_TO_BODY(ObjectHeader) \
   ((PVOID)(((PUSER_OBJECT_HEADER)ObjectHeader) + 1))

Modified: trunk/reactos/subsystems/win32/win32k/objects/stockobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/stockobj.c?rev=33418&r1=33417&r2=33418&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] Sat May 10 14:03:58 2008
@@ -107,11 +107,6 @@
 { 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
   0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Sans Serif" }; //Bitstream Vera Sans
 
-/* Comments from reserve two extra entry for the stock default bitmap  this is what Windows does too 
- * and verify if it is true it is not. in XP/2003 it is 22 stockobjects for each bitmap
- */
-#define NB_STOCK_OBJECTS (PRV_STOCK_LAST)
-
 static HGDIOBJ StockObjects[NB_STOCK_OBJECTS];
 
 /*!
@@ -139,8 +134,8 @@
   StockObjects[DC_PEN]    = IntGdiExtCreatePen(BlackPen.lopnStyle, BlackPen.lopnWidth.x, BS_SOLID, BlackPen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
   StockObjects[NULL_PEN] = IntGdiExtCreatePen(NullPen.lopnStyle, NullPen.lopnWidth.x, BS_SOLID, NullPen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
 
-  StockObjects[20] = NULL;
-  StockObjects[DC_BITMAP] = IntGdiCreateBitmap (1, 1, 1, 1, NULL);
+  StockObjects[20] = NULL; /* TODO: Unknown internal stock object */
+  StockObjects[DEFAULT_BITMAP] = IntGdiCreateBitmap(1, 1, 1, 1, NULL);
 
   (void) TextIntCreateFontIndirect(&OEMFixedFont, (HFONT*)&StockObjects[OEM_FIXED_FONT]);
   (void) TextIntCreateFontIndirect(&AnsiFixedFont, (HFONT*)&StockObjects[ANSI_FIXED_FONT]);



More information about the Ros-diffs mailing list