From e1d6ad5272eca7fe9139a9ea2b67449d77427939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Sun, 1 Feb 2004 15:45:41 +0000 Subject: [PATCH] Rename BITMAPOBJ "size" member to "dimension" to make clear it's to be used for Get/SetBitmapDimensionEx only. Fix current wrong usage. svn path=/trunk/; revision=7960 --- reactos/include/win32k/bitmaps.h | 5 ++++- reactos/subsys/win32k/objects/bitmaps.c | 14 ++++++------- reactos/subsys/win32k/objects/cursoricon.c | 23 ++++++++++++---------- reactos/subsys/win32k/objects/dc.c | 4 ++-- reactos/subsys/win32k/objects/objconv.c | 9 ++++++--- 5 files changed, 32 insertions(+), 23 deletions(-) diff --git a/reactos/include/win32k/bitmaps.h b/reactos/include/win32k/bitmaps.h index 7613be988f0..2e04afc8cc7 100644 --- a/reactos/include/win32k/bitmaps.h +++ b/reactos/include/win32k/bitmaps.h @@ -16,7 +16,10 @@ typedef struct _DDBITMAP typedef struct _BITMAPOBJ { BITMAP bitmap; - SIZE size; /* For SetBitmapDimension() */ + SIZE dimension; /* For SetBitmapDimension(), do NOT use + to get width/height of bitmap, use + bitmap.bmWidth/bitmap.bmHeight for + that */ DDBITMAP *DDBitmap; diff --git a/reactos/subsys/win32k/objects/bitmaps.c b/reactos/subsys/win32k/objects/bitmaps.c index ef5e5f73215..d4089e96dbd 100644 --- a/reactos/subsys/win32k/objects/bitmaps.c +++ b/reactos/subsys/win32k/objects/bitmaps.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: bitmaps.c,v 1.52 2004/01/10 01:50:49 rcampbell Exp $ */ +/* $Id: bitmaps.c,v 1.53 2004/02/01 15:45:41 gvg Exp $ */ #undef WIN32_LEAN_AND_MEAN #include #include @@ -277,8 +277,8 @@ HBITMAP STDCALL NtGdiCreateBitmap(INT Width, DPRINT("NtGdiCreateBitmap:%dx%d, %d (%d BPP) colors returning %08x\n", Width, Height, 1 << (Planes * BitsPerPel), BitsPerPel, bmp); - bmp->size.cx = Width; - bmp->size.cy = Height; + bmp->dimension.cx = 0; + bmp->dimension.cy = 0; bmp->bitmap.bmType = 0; bmp->bitmap.bmWidth = Width; bmp->bitmap.bmHeight = Height; @@ -412,7 +412,7 @@ BOOL STDCALL NtGdiGetBitmapDimensionEx(HBITMAP hBitmap, return FALSE; } - *Dimension = bmp->size; + *Dimension = bmp->dimension; BITMAPOBJ_UnlockBitmap(hBitmap); @@ -763,10 +763,10 @@ BOOL STDCALL NtGdiSetBitmapDimensionEx(HBITMAP hBitmap, if (Size) { - *Size = bmp->size; + *Size = bmp->dimension; } - bmp->size.cx = Width; - bmp->size.cy = Height; + bmp->dimension.cx = Width; + bmp->dimension.cy = Height; BITMAPOBJ_UnlockBitmap (hBitmap); diff --git a/reactos/subsys/win32k/objects/cursoricon.c b/reactos/subsys/win32k/objects/cursoricon.c index 5b58b9b128d..2f638d6a24c 100644 --- a/reactos/subsys/win32k/objects/cursoricon.c +++ b/reactos/subsys/win32k/objects/cursoricon.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: cursoricon.c,v 1.45 2004/01/24 19:47:05 navaraf Exp $ */ +/* $Id: cursoricon.c,v 1.46 2004/02/01 15:45:41 gvg Exp $ */ #undef WIN32_LEAN_AND_MEAN @@ -452,8 +452,8 @@ NtUserCreateCursorIconHandle(PICONINFO IconInfo, BOOL Indirect) if(CurIconObject->IconInfo.hbmColor && (bmp = BITMAPOBJ_LockBitmap(CurIconObject->IconInfo.hbmColor))) { - CurIconObject->Size.cx = bmp->size.cx; - CurIconObject->Size.cy = bmp->size.cy; + CurIconObject->Size.cx = bmp->bitmap.bmWidth; + CurIconObject->Size.cy = bmp->bitmap.bmHeight; BITMAPOBJ_UnlockBitmap(CurIconObject->IconInfo.hbmColor); } else @@ -461,8 +461,8 @@ NtUserCreateCursorIconHandle(PICONINFO IconInfo, BOOL Indirect) if(CurIconObject->IconInfo.hbmMask && (bmp = BITMAPOBJ_LockBitmap(CurIconObject->IconInfo.hbmMask))) { - CurIconObject->Size.cx = bmp->size.cx; - CurIconObject->Size.cy = bmp->size.cy / 2; + CurIconObject->Size.cx = bmp->bitmap.bmWidth; + CurIconObject->Size.cy = bmp->bitmap.bmHeight / 2; BITMAPOBJ_UnlockBitmap(CurIconObject->IconInfo.hbmMask); } } @@ -558,6 +558,7 @@ NtUserGetCursorIconSize( PWINSTATION_OBJECT WinStaObject; NTSTATUS Status; BOOL Ret = FALSE; + SIZE SafeSize; Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(), KernelMode, @@ -585,7 +586,9 @@ NtUserGetCursorIconSize( if(!bmp) goto done; - Status = MmCopyToCaller(Size, &bmp->size, sizeof(SIZE)); + SafeSize.cx = bmp->bitmap.bmWidth; + SafeSize.cy = bmp->bitmap.bmHeight; + Status = MmCopyToCaller(Size, &SafeSize, sizeof(SIZE)); if(NT_SUCCESS(Status)) Ret = TRUE; else @@ -953,8 +956,8 @@ NtUserSetCursorIconContents( bmp = BITMAPOBJ_LockBitmap(CurIconObject->IconInfo.hbmColor); if(bmp) { - CurIconObject->Size.cx = bmp->size.cx; - CurIconObject->Size.cy = bmp->size.cy; + CurIconObject->Size.cx = bmp->bitmap.bmWidth; + CurIconObject->Size.cy = bmp->bitmap.bmHeight; BITMAPOBJ_UnlockBitmap(CurIconObject->IconInfo.hbmColor); } else @@ -963,8 +966,8 @@ NtUserSetCursorIconContents( if(!bmp) goto done; - CurIconObject->Size.cx = bmp->size.cx; - CurIconObject->Size.cy = bmp->size.cy / 2; + CurIconObject->Size.cx = bmp->bitmap.bmWidth; + CurIconObject->Size.cy = bmp->bitmap.bmHeight / 2; BITMAPOBJ_UnlockBitmap(CurIconObject->IconInfo.hbmMask); } diff --git a/reactos/subsys/win32k/objects/dc.c b/reactos/subsys/win32k/objects/dc.c index 5c1fed554e1..6e547e38a2d 100644 --- a/reactos/subsys/win32k/objects/dc.c +++ b/reactos/subsys/win32k/objects/dc.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: dc.c,v 1.119 2004/01/25 16:47:10 navaraf Exp $ +/* $Id: dc.c,v 1.120 2004/02/01 15:45:41 gvg Exp $ * * DC.C - Device context functions * @@ -1838,7 +1838,7 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj) } DC_UnlockDc ( hDC ); - hVisRgn = NtGdiCreateRectRgn ( 0, 0, pb->size.cx, pb->size.cy ); + hVisRgn = NtGdiCreateRectRgn ( 0, 0, pb->bitmap.bmWidth, pb->bitmap.bmHeight ); NtGdiSelectVisRgn ( hDC, hVisRgn ); NtGdiDeleteObject ( hVisRgn ); BITMAPOBJ_UnlockBitmap(hGDIObj); diff --git a/reactos/subsys/win32k/objects/objconv.c b/reactos/subsys/win32k/objects/objconv.c index 9f5effdcefc..c5d08647935 100644 --- a/reactos/subsys/win32k/objects/objconv.c +++ b/reactos/subsys/win32k/objects/objconv.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: objconv.c,v 1.14 2004/01/16 19:32:00 gvg Exp $ */ +/* $Id: objconv.c,v 1.15 2004/02/01 15:45:41 gvg Exp $ */ #undef WIN32_LEAN_AND_MEAN #include @@ -70,17 +70,20 @@ HPenToBrushObj ( BRUSHOBJ *brush, HPEN hpen ) HBITMAP FASTCALL BitmapToSurf(PBITMAPOBJ BitmapObj, HDEV GDIDevice) { HBITMAP BitmapHandle; + SIZE Size; ASSERT ( BitmapObj ); + Size.cx = BitmapObj->bitmap.bmWidth; + Size.cy = BitmapObj->bitmap.bmHeight; if (NULL != BitmapObj->dib) { - BitmapHandle = EngCreateBitmap(BitmapObj->size, BitmapObj->dib->dsBm.bmWidthBytes, + BitmapHandle = EngCreateBitmap(Size, BitmapObj->dib->dsBm.bmWidthBytes, BitmapFormat(BitmapObj->dib->dsBm.bmBitsPixel, BI_RGB), 0, BitmapObj->dib->dsBm.bmBits); } else { - BitmapHandle = EngCreateBitmap(BitmapObj->size, BitmapObj->bitmap.bmWidthBytes, + BitmapHandle = EngCreateBitmap(Size, BitmapObj->bitmap.bmWidthBytes, BitmapFormat(BitmapObj->bitmap.bmBitsPixel, BI_RGB), 0, BitmapObj->bitmap.bmBits); }