mirror of
https://github.com/reactos/reactos.git
synced 2025-06-15 20:08:37 +00:00
[FORMATTING]
- apply ansi style formatting with an indentation of 4 spaces - Add 2 FIXME comments, regarding MmSecureVirtualmemory - no code change svn path=/trunk/; revision=40073
This commit is contained in:
parent
0f06669f19
commit
cf3d6a794f
1 changed files with 646 additions and 620 deletions
|
@ -42,6 +42,7 @@ IntGdiCreateBitmap(
|
||||||
HBITMAP hBitmap;
|
HBITMAP hBitmap;
|
||||||
SIZEL Size;
|
SIZEL Size;
|
||||||
LONG WidthBytes;
|
LONG WidthBytes;
|
||||||
|
PSURFACE psurfBmp;
|
||||||
|
|
||||||
/* NOTE: Windows also doesn't store nr. of planes separately! */
|
/* NOTE: Windows also doesn't store nr. of planes separately! */
|
||||||
BitsPixel = BITMAP_GetRealBitsPixel(BitsPixel * Planes);
|
BitsPixel = BITMAP_GetRealBitsPixel(BitsPixel * Planes);
|
||||||
|
@ -49,7 +50,8 @@ IntGdiCreateBitmap(
|
||||||
/* Check parameters */
|
/* Check parameters */
|
||||||
if (BitsPixel == 0 || Width <= 0 || Width >= 0x8000000 || Height == 0)
|
if (BitsPixel == 0 || Width <= 0 || Width >= 0x8000000 || Height == 0)
|
||||||
{
|
{
|
||||||
DPRINT1("Width = %d, Height = %d BitsPixel = %d\n", Width, Height, BitsPixel);
|
DPRINT1("Width = %d, Height = %d BitsPixel = %d\n",
|
||||||
|
Width, Height, BitsPixel);
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +64,8 @@ IntGdiCreateBitmap(
|
||||||
/* Make sure that cjBits will not overflow */
|
/* Make sure that cjBits will not overflow */
|
||||||
if ((ULONGLONG)WidthBytes * Size.cy >= 0x100000000ULL)
|
if ((ULONGLONG)WidthBytes * Size.cy >= 0x100000000ULL)
|
||||||
{
|
{
|
||||||
DPRINT1("Width = %d, Height = %d BitsPixel = %d\n", Width, Height, BitsPixel);
|
DPRINT1("Width = %d, Height = %d BitsPixel = %d\n",
|
||||||
|
Width, Height, BitsPixel);
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +81,7 @@ IntGdiCreateBitmap(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSURFACE psurfBmp = SURFACE_LockSurface(hBitmap);
|
psurfBmp = SURFACE_LockSurface(hBitmap);
|
||||||
if (psurfBmp == NULL)
|
if (psurfBmp == NULL)
|
||||||
{
|
{
|
||||||
NtGdiDeleteObject(hBitmap);
|
NtGdiDeleteObject(hBitmap);
|
||||||
|
@ -115,6 +118,7 @@ NtGdiCreateBitmap(
|
||||||
BOOL Hit = FALSE;
|
BOOL Hit = FALSE;
|
||||||
UINT cjBits = BITMAP_GetWidthBytes(Width, BitsPixel) * abs(Height);
|
UINT cjBits = BITMAP_GetWidthBytes(Width, BitsPixel) * abs(Height);
|
||||||
|
|
||||||
|
// FIXME: Use MmSecureVirtualMemory
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
ProbeForRead(pUnsafeBits, cjBits, 1);
|
ProbeForRead(pUnsafeBits, cjBits, 1);
|
||||||
|
@ -165,7 +169,6 @@ IntCreateCompatibleBitmap(
|
||||||
{
|
{
|
||||||
if (Count == sizeof(BITMAP))
|
if (Count == sizeof(BITMAP))
|
||||||
{
|
{
|
||||||
|
|
||||||
/* We have a bitmap bug!!! W/O the HACK, we have white icons.
|
/* We have a bitmap bug!!! W/O the HACK, we have white icons.
|
||||||
|
|
||||||
MSDN Note: When a memory device context is created, it initially
|
MSDN Note: When a memory device context is created, it initially
|
||||||
|
@ -186,7 +189,6 @@ IntCreateCompatibleBitmap(
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
||||||
{
|
{
|
||||||
/* A DIB section is selected in the DC */
|
/* A DIB section is selected in the DC */
|
||||||
BITMAPINFO *bi;
|
BITMAPINFO *bi;
|
||||||
|
@ -196,7 +198,10 @@ IntCreateCompatibleBitmap(
|
||||||
color table. The maximum number of colors in a color table
|
color table. The maximum number of colors in a color table
|
||||||
is 256 which corresponds to a bitmap with depth 8.
|
is 256 which corresponds to a bitmap with depth 8.
|
||||||
Bitmaps with higher depths don't have color tables. */
|
Bitmaps with higher depths don't have color tables. */
|
||||||
bi = ExAllocatePoolWithTag(PagedPool, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD), TAG_TEMP);
|
bi = ExAllocatePoolWithTag(PagedPool,
|
||||||
|
sizeof(BITMAPINFOHEADER) +
|
||||||
|
256 * sizeof(RGBQUAD),
|
||||||
|
TAG_TEMP);
|
||||||
|
|
||||||
if (bi)
|
if (bi)
|
||||||
{
|
{
|
||||||
|
@ -283,7 +288,8 @@ NtGdiCreateCompatibleBitmap(
|
||||||
|
|
||||||
Dc = DC_LockDc(hDC);
|
Dc = DC_LockDc(hDC);
|
||||||
|
|
||||||
DPRINT("NtGdiCreateCompatibleBitmap(%04x,%d,%d, bpp:%d) = \n", hDC, Width, Height, ((PGDIDEVICE)Dc->pPDev)->GDIInfo.cBitsPixel);
|
DPRINT("NtGdiCreateCompatibleBitmap(%04x,%d,%d, bpp:%d) = \n",
|
||||||
|
hDC, Width, Height, ((PGDIDEVICE)Dc->pPDev)->GDIInfo.cBitsPixel);
|
||||||
|
|
||||||
if (NULL == Dc)
|
if (NULL == Dc)
|
||||||
{
|
{
|
||||||
|
@ -351,11 +357,13 @@ NtGdiGetPixel(HDC hDC, INT XPos, INT YPos)
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dc->DC_Type == DC_TYPE_INFO)
|
if (dc->DC_Type == DC_TYPE_INFO)
|
||||||
{
|
{
|
||||||
DC_UnlockDc(dc);
|
DC_UnlockDc(dc);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
XPos += dc->ptlDCOrig.x;
|
XPos += dc->ptlDCOrig.x;
|
||||||
YPos += dc->ptlDCOrig.y;
|
YPos += dc->ptlDCOrig.y;
|
||||||
if (IN_RECT(dc->CombinedClip->rclBounds,XPos,YPos))
|
if (IN_RECT(dc->CombinedClip->rclBounds,XPos,YPos))
|
||||||
|
@ -458,7 +466,10 @@ IntGetBitmapBits(
|
||||||
DPRINT("Calling device specific BitmapBits\n");
|
DPRINT("Calling device specific BitmapBits\n");
|
||||||
if (psurf->DDBitmap->funcs->pBitmapBits)
|
if (psurf->DDBitmap->funcs->pBitmapBits)
|
||||||
{
|
{
|
||||||
ret = psurf->DDBitmap->funcs->pBitmapBits(hbitmap, bits, count, DDB_GET);
|
ret = psurf->DDBitmap->funcs->pBitmapBits(hbitmap,
|
||||||
|
bits,
|
||||||
|
count,
|
||||||
|
DDB_GET);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -476,7 +487,8 @@ IntGetBitmapBits(
|
||||||
}
|
}
|
||||||
|
|
||||||
LONG APIENTRY
|
LONG APIENTRY
|
||||||
NtGdiGetBitmapBits(HBITMAP hBitmap,
|
NtGdiGetBitmapBits(
|
||||||
|
HBITMAP hBitmap,
|
||||||
ULONG Bytes,
|
ULONG Bytes,
|
||||||
OUT OPTIONAL PBYTE pUnsafeBits)
|
OUT OPTIONAL PBYTE pUnsafeBits)
|
||||||
{
|
{
|
||||||
|
@ -506,6 +518,7 @@ NtGdiGetBitmapBits(HBITMAP hBitmap,
|
||||||
/* Don't copy more bytes than the buffer has */
|
/* Don't copy more bytes than the buffer has */
|
||||||
Bytes = min(Bytes, psurf->SurfObj.cjBits);
|
Bytes = min(Bytes, psurf->SurfObj.cjBits);
|
||||||
|
|
||||||
|
// FIXME: use MmSecureVirtualMemory
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
ProbeForWrite(pUnsafeBits, Bytes, 1);
|
ProbeForWrite(pUnsafeBits, Bytes, 1);
|
||||||
|
@ -541,7 +554,10 @@ IntSetBitmapBits(
|
||||||
DPRINT("Calling device specific BitmapBits\n");
|
DPRINT("Calling device specific BitmapBits\n");
|
||||||
if (psurf->DDBitmap->funcs->pBitmapBits)
|
if (psurf->DDBitmap->funcs->pBitmapBits)
|
||||||
{
|
{
|
||||||
ret = psurf->DDBitmap->funcs->pBitmapBits(hBitmap, (void *) Bits, Bytes, DDB_SET);
|
ret = psurf->DDBitmap->funcs->pBitmapBits(hBitmap,
|
||||||
|
(void *)Bits,
|
||||||
|
Bytes,
|
||||||
|
DDB_SET);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -652,15 +668,18 @@ GdiSetPixelV(
|
||||||
|
|
||||||
if (NewBrush == NULL)
|
if (NewBrush == NULL)
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
|
||||||
OldBrush = NtGdiSelectBrush(hDC, NewBrush);
|
OldBrush = NtGdiSelectBrush(hDC, NewBrush);
|
||||||
if (OldBrush == NULL)
|
if (OldBrush == NULL)
|
||||||
{
|
{
|
||||||
NtGdiDeleteObject(NewBrush);
|
NtGdiDeleteObject(NewBrush);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NtGdiPatBlt(hDC, X, Y, 1, 1, PATCOPY);
|
NtGdiPatBlt(hDC, X, Y, 1, 1, PATCOPY);
|
||||||
NtGdiSelectBrush(hDC, OldBrush);
|
NtGdiSelectBrush(hDC, OldBrush);
|
||||||
NtGdiDeleteObject(NewBrush);
|
NtGdiDeleteObject(NewBrush);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -680,7 +699,7 @@ NtGdiSetPixel(
|
||||||
return Color;
|
return Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color = ((COLORREF) CLR_INVALID);
|
Color = (COLORREF)CLR_INVALID;
|
||||||
DPRINT("2 NtGdiSetPixel X %ld Y %ld C %ld\n", X, Y, Color);
|
DPRINT("2 NtGdiSetPixel X %ld Y %ld C %ld\n", X, Y, Color);
|
||||||
return Color;
|
return Color;
|
||||||
}
|
}
|
||||||
|
@ -780,7 +799,9 @@ BITMAP_CopyBitmap(HBITMAP hBitmap)
|
||||||
resBitmap = GDIOBJ_LockObj(res, GDI_OBJECT_TYPE_BITMAP);
|
resBitmap = GDIOBJ_LockObj(res, GDI_OBJECT_TYPE_BITMAP);
|
||||||
if (resBitmap)
|
if (resBitmap)
|
||||||
{
|
{
|
||||||
buf = ExAllocatePoolWithTag (PagedPool, bm.bmWidthBytes * abs(bm.bmHeight), TAG_BITMAP);
|
buf = ExAllocatePoolWithTag(PagedPool,
|
||||||
|
bm.bmWidthBytes * abs(bm.bmHeight),
|
||||||
|
TAG_BITMAP);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
{
|
{
|
||||||
GDIOBJ_UnlockObjByPtr((POBJ)resBitmap);
|
GDIOBJ_UnlockObjByPtr((POBJ)resBitmap);
|
||||||
|
@ -856,7 +877,8 @@ BITMAP_GetObject(SURFACE *psurf, INT Count, LPVOID buffer)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pBitmap->bmBits = NULL; /* not set according to wine test, confirmed in win2k */
|
/* not set according to wine test, confirmed in win2k */
|
||||||
|
pBitmap->bmBits = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sizeof(BITMAP);
|
return sizeof(BITMAP);
|
||||||
|
@ -930,7 +952,8 @@ NtGdiSelectBitmap(
|
||||||
pDC->DcLevel.pSurface = psurfBmp;
|
pDC->DcLevel.pSurface = psurfBmp;
|
||||||
psurfBmp->hDC = hDC;
|
psurfBmp->hDC = hDC;
|
||||||
|
|
||||||
// if we're working with a DIB, get the palette [fixme: only create if the selected palette is null]
|
// if we're working with a DIB, get the palette
|
||||||
|
// [fixme: only create if the selected palette is null]
|
||||||
if (psurfBmp->hSecure)
|
if (psurfBmp->hSecure)
|
||||||
{
|
{
|
||||||
// pDC->w.bitsPerPixel = psurfBmp->dib->dsBmih.biBitCount; ???
|
// pDC->w.bitsPerPixel = psurfBmp->dib->dsBmih.biBitCount; ???
|
||||||
|
@ -941,7 +964,10 @@ NtGdiSelectBitmap(
|
||||||
pDC->w.bitsPerPixel = BitsPerFormat(psurfBmp->SurfObj.iBitmapFormat);
|
pDC->w.bitsPerPixel = BitsPerFormat(psurfBmp->SurfObj.iBitmapFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
hVisRgn = NtGdiCreateRectRgn(0, 0, psurfBmp->SurfObj.sizlBitmap.cx, psurfBmp->SurfObj.sizlBitmap.cy);
|
hVisRgn = NtGdiCreateRectRgn(0,
|
||||||
|
0,
|
||||||
|
psurfBmp->SurfObj.sizlBitmap.cx,
|
||||||
|
psurfBmp->SurfObj.sizlBitmap.cy);
|
||||||
SURFACE_UnlockSurface(psurfBmp);
|
SURFACE_UnlockSurface(psurfBmp);
|
||||||
|
|
||||||
/* Regenerate the XLATEOBJs. */
|
/* Regenerate the XLATEOBJs. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue