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
This commit is contained in:
Gé van Geldorp 2004-02-01 15:45:41 +00:00
parent 2cb71414cb
commit e1d6ad5272
5 changed files with 32 additions and 23 deletions

View file

@ -16,7 +16,10 @@ typedef struct _DDBITMAP
typedef struct _BITMAPOBJ typedef struct _BITMAPOBJ
{ {
BITMAP bitmap; 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; DDBITMAP *DDBitmap;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 #undef WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <stdlib.h> #include <stdlib.h>
@ -277,8 +277,8 @@ HBITMAP STDCALL NtGdiCreateBitmap(INT Width,
DPRINT("NtGdiCreateBitmap:%dx%d, %d (%d BPP) colors returning %08x\n", Width, Height, DPRINT("NtGdiCreateBitmap:%dx%d, %d (%d BPP) colors returning %08x\n", Width, Height,
1 << (Planes * BitsPerPel), BitsPerPel, bmp); 1 << (Planes * BitsPerPel), BitsPerPel, bmp);
bmp->size.cx = Width; bmp->dimension.cx = 0;
bmp->size.cy = Height; bmp->dimension.cy = 0;
bmp->bitmap.bmType = 0; bmp->bitmap.bmType = 0;
bmp->bitmap.bmWidth = Width; bmp->bitmap.bmWidth = Width;
bmp->bitmap.bmHeight = Height; bmp->bitmap.bmHeight = Height;
@ -412,7 +412,7 @@ BOOL STDCALL NtGdiGetBitmapDimensionEx(HBITMAP hBitmap,
return FALSE; return FALSE;
} }
*Dimension = bmp->size; *Dimension = bmp->dimension;
BITMAPOBJ_UnlockBitmap(hBitmap); BITMAPOBJ_UnlockBitmap(hBitmap);
@ -763,10 +763,10 @@ BOOL STDCALL NtGdiSetBitmapDimensionEx(HBITMAP hBitmap,
if (Size) if (Size)
{ {
*Size = bmp->size; *Size = bmp->dimension;
} }
bmp->size.cx = Width; bmp->dimension.cx = Width;
bmp->size.cy = Height; bmp->dimension.cy = Height;
BITMAPOBJ_UnlockBitmap (hBitmap); BITMAPOBJ_UnlockBitmap (hBitmap);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 #undef WIN32_LEAN_AND_MEAN
@ -452,8 +452,8 @@ NtUserCreateCursorIconHandle(PICONINFO IconInfo, BOOL Indirect)
if(CurIconObject->IconInfo.hbmColor && if(CurIconObject->IconInfo.hbmColor &&
(bmp = BITMAPOBJ_LockBitmap(CurIconObject->IconInfo.hbmColor))) (bmp = BITMAPOBJ_LockBitmap(CurIconObject->IconInfo.hbmColor)))
{ {
CurIconObject->Size.cx = bmp->size.cx; CurIconObject->Size.cx = bmp->bitmap.bmWidth;
CurIconObject->Size.cy = bmp->size.cy; CurIconObject->Size.cy = bmp->bitmap.bmHeight;
BITMAPOBJ_UnlockBitmap(CurIconObject->IconInfo.hbmColor); BITMAPOBJ_UnlockBitmap(CurIconObject->IconInfo.hbmColor);
} }
else else
@ -461,8 +461,8 @@ NtUserCreateCursorIconHandle(PICONINFO IconInfo, BOOL Indirect)
if(CurIconObject->IconInfo.hbmMask && if(CurIconObject->IconInfo.hbmMask &&
(bmp = BITMAPOBJ_LockBitmap(CurIconObject->IconInfo.hbmMask))) (bmp = BITMAPOBJ_LockBitmap(CurIconObject->IconInfo.hbmMask)))
{ {
CurIconObject->Size.cx = bmp->size.cx; CurIconObject->Size.cx = bmp->bitmap.bmWidth;
CurIconObject->Size.cy = bmp->size.cy / 2; CurIconObject->Size.cy = bmp->bitmap.bmHeight / 2;
BITMAPOBJ_UnlockBitmap(CurIconObject->IconInfo.hbmMask); BITMAPOBJ_UnlockBitmap(CurIconObject->IconInfo.hbmMask);
} }
} }
@ -558,6 +558,7 @@ NtUserGetCursorIconSize(
PWINSTATION_OBJECT WinStaObject; PWINSTATION_OBJECT WinStaObject;
NTSTATUS Status; NTSTATUS Status;
BOOL Ret = FALSE; BOOL Ret = FALSE;
SIZE SafeSize;
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(), Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode, KernelMode,
@ -585,7 +586,9 @@ NtUserGetCursorIconSize(
if(!bmp) if(!bmp)
goto done; 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)) if(NT_SUCCESS(Status))
Ret = TRUE; Ret = TRUE;
else else
@ -953,8 +956,8 @@ NtUserSetCursorIconContents(
bmp = BITMAPOBJ_LockBitmap(CurIconObject->IconInfo.hbmColor); bmp = BITMAPOBJ_LockBitmap(CurIconObject->IconInfo.hbmColor);
if(bmp) if(bmp)
{ {
CurIconObject->Size.cx = bmp->size.cx; CurIconObject->Size.cx = bmp->bitmap.bmWidth;
CurIconObject->Size.cy = bmp->size.cy; CurIconObject->Size.cy = bmp->bitmap.bmHeight;
BITMAPOBJ_UnlockBitmap(CurIconObject->IconInfo.hbmColor); BITMAPOBJ_UnlockBitmap(CurIconObject->IconInfo.hbmColor);
} }
else else
@ -963,8 +966,8 @@ NtUserSetCursorIconContents(
if(!bmp) if(!bmp)
goto done; goto done;
CurIconObject->Size.cx = bmp->size.cx; CurIconObject->Size.cx = bmp->bitmap.bmWidth;
CurIconObject->Size.cy = bmp->size.cy / 2; CurIconObject->Size.cy = bmp->bitmap.bmHeight / 2;
BITMAPOBJ_UnlockBitmap(CurIconObject->IconInfo.hbmMask); BITMAPOBJ_UnlockBitmap(CurIconObject->IconInfo.hbmMask);
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * DC.C - Device context functions
* *
@ -1838,7 +1838,7 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
} }
DC_UnlockDc ( hDC ); 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 ); NtGdiSelectVisRgn ( hDC, hVisRgn );
NtGdiDeleteObject ( hVisRgn ); NtGdiDeleteObject ( hVisRgn );
BITMAPOBJ_UnlockBitmap(hGDIObj); BITMAPOBJ_UnlockBitmap(hGDIObj);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 #undef WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
@ -70,17 +70,20 @@ HPenToBrushObj ( BRUSHOBJ *brush, HPEN hpen )
HBITMAP FASTCALL BitmapToSurf(PBITMAPOBJ BitmapObj, HDEV GDIDevice) HBITMAP FASTCALL BitmapToSurf(PBITMAPOBJ BitmapObj, HDEV GDIDevice)
{ {
HBITMAP BitmapHandle; HBITMAP BitmapHandle;
SIZE Size;
ASSERT ( BitmapObj ); ASSERT ( BitmapObj );
Size.cx = BitmapObj->bitmap.bmWidth;
Size.cy = BitmapObj->bitmap.bmHeight;
if (NULL != BitmapObj->dib) 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), BitmapFormat(BitmapObj->dib->dsBm.bmBitsPixel, BI_RGB),
0, BitmapObj->dib->dsBm.bmBits); 0, BitmapObj->dib->dsBm.bmBits);
} }
else else
{ {
BitmapHandle = EngCreateBitmap(BitmapObj->size, BitmapObj->bitmap.bmWidthBytes, BitmapHandle = EngCreateBitmap(Size, BitmapObj->bitmap.bmWidthBytes,
BitmapFormat(BitmapObj->bitmap.bmBitsPixel, BI_RGB), BitmapFormat(BitmapObj->bitmap.bmBitsPixel, BI_RGB),
0, BitmapObj->bitmap.bmBits); 0, BitmapObj->bitmap.bmBits);
} }