mirror of
https://github.com/reactos/reactos.git
synced 2024-09-09 12:20:21 +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
|
@ -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);
|
||||||
|
@ -148,7 +152,7 @@ IntCreateCompatibleBitmap(
|
||||||
{
|
{
|
||||||
if (Dc->DC_Type != DC_TYPE_MEMORY)
|
if (Dc->DC_Type != DC_TYPE_MEMORY)
|
||||||
{
|
{
|
||||||
Bmp = IntGdiCreateBitmap( abs(Width),
|
Bmp = IntGdiCreateBitmap(abs(Width),
|
||||||
abs(Height),
|
abs(Height),
|
||||||
IntGdiGetDeviceCaps(Dc,PLANES),
|
IntGdiGetDeviceCaps(Dc,PLANES),
|
||||||
IntGdiGetDeviceCaps(Dc,BITSPIXEL),
|
IntGdiGetDeviceCaps(Dc,BITSPIXEL),
|
||||||
|
@ -158,14 +162,13 @@ IntCreateCompatibleBitmap(
|
||||||
{
|
{
|
||||||
DIBSECTION dibs;
|
DIBSECTION dibs;
|
||||||
INT Count;
|
INT Count;
|
||||||
PSURFACE psurf = SURFACE_LockSurface( Dc->w.hBitmap );
|
PSURFACE psurf = SURFACE_LockSurface(Dc->w.hBitmap);
|
||||||
Count = BITMAP_GetObject(psurf, sizeof(dibs), &dibs);
|
Count = BITMAP_GetObject(psurf, sizeof(dibs), &dibs);
|
||||||
|
|
||||||
if (Count)
|
if (Count)
|
||||||
{
|
{
|
||||||
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
|
||||||
|
@ -175,18 +178,17 @@ IntCreateCompatibleBitmap(
|
||||||
the hDC that was used to create the memory device context, as
|
the hDC that was used to create the memory device context, as
|
||||||
shown in the following code:
|
shown in the following code:
|
||||||
|
|
||||||
HDC memDC = CreateCompatibleDC ( hDC );
|
HDC memDC = CreateCompatibleDC(hDC);
|
||||||
HBITMAP memBM = CreateCompatibleBitmap ( hDC, nWidth, nHeight );
|
HBITMAP memBM = CreateCompatibleBitmap(hDC, nWidth, nHeight);
|
||||||
SelectObject ( memDC, memBM );
|
SelectObject(memDC, memBM);
|
||||||
*/
|
*/
|
||||||
Bmp = IntGdiCreateBitmap( abs(Width),
|
Bmp = IntGdiCreateBitmap(abs(Width),
|
||||||
abs(Height),
|
abs(Height),
|
||||||
dibs.dsBm.bmPlanes,
|
dibs.dsBm.bmPlanes,
|
||||||
IntGdiGetDeviceCaps(Dc,BITSPIXEL),//<-- HACK! dibs.dsBm.bmBitsPixel, // <-- Correct!
|
IntGdiGetDeviceCaps(Dc,BITSPIXEL),//<-- HACK! dibs.dsBm.bmBitsPixel, // <-- Correct!
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -226,7 +231,7 @@ IntCreateCompatibleBitmap(
|
||||||
if (!PalGDI)
|
if (!PalGDI)
|
||||||
{
|
{
|
||||||
ExFreePoolWithTag(bi, TAG_TEMP);
|
ExFreePoolWithTag(bi, TAG_TEMP);
|
||||||
SURFACE_UnlockSurface( psurf );
|
SURFACE_UnlockSurface(psurf);
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -244,7 +249,7 @@ IntCreateCompatibleBitmap(
|
||||||
}
|
}
|
||||||
SURFACE_UnlockSurface(psurf);
|
SURFACE_UnlockSurface(psurf);
|
||||||
|
|
||||||
Bmp = DIB_CreateDIBSection ( Dc,
|
Bmp = DIB_CreateDIBSection(Dc,
|
||||||
bi,
|
bi,
|
||||||
DIB_RGB_COLORS,
|
DIB_RGB_COLORS,
|
||||||
&Bits,
|
&Bits,
|
||||||
|
@ -272,7 +277,7 @@ NtGdiCreateCompatibleBitmap(
|
||||||
HBITMAP Bmp;
|
HBITMAP Bmp;
|
||||||
PDC Dc;
|
PDC Dc;
|
||||||
|
|
||||||
if ( Width <= 0 || Height <= 0 || (Width * Height) > 0x3FFFFFFF )
|
if (Width <= 0 || Height <= 0 || (Width * Height) > 0x3FFFFFFF)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -293,7 +299,7 @@ NtGdiCreateCompatibleBitmap(
|
||||||
|
|
||||||
Bmp = IntCreateCompatibleBitmap(Dc, Width, Height);
|
Bmp = IntCreateCompatibleBitmap(Dc, Width, Height);
|
||||||
|
|
||||||
DPRINT ("\t\t%04x\n", Bmp);
|
DPRINT("\t\t%04x\n", Bmp);
|
||||||
DC_UnlockDc(Dc);
|
DC_UnlockDc(Dc);
|
||||||
return Bmp;
|
return Bmp;
|
||||||
}
|
}
|
||||||
|
@ -344,40 +350,42 @@ NtGdiGetPixel(HDC hDC, INT XPos, INT YPos)
|
||||||
XLATEOBJ *XlateObj;
|
XLATEOBJ *XlateObj;
|
||||||
HBITMAP hBmpTmp;
|
HBITMAP hBmpTmp;
|
||||||
|
|
||||||
dc = DC_LockDc (hDC);
|
dc = DC_LockDc(hDC);
|
||||||
|
|
||||||
if ( !dc )
|
if (!dc)
|
||||||
{
|
{
|
||||||
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))
|
||||||
{
|
{
|
||||||
bInRect = TRUE;
|
bInRect = TRUE;
|
||||||
psurf = SURFACE_LockSurface(dc->w.hBitmap);
|
psurf = SURFACE_LockSurface(dc->w.hBitmap);
|
||||||
pso = &psurf->SurfObj;
|
pso = &psurf->SurfObj;
|
||||||
if ( psurf )
|
if (psurf)
|
||||||
{
|
{
|
||||||
Pal = psurf->hDIBPalette;
|
Pal = psurf->hDIBPalette;
|
||||||
if (!Pal) Pal = pPrimarySurface->DevInfo.hpalDefault;
|
if (!Pal) Pal = pPrimarySurface->DevInfo.hpalDefault;
|
||||||
|
|
||||||
/* FIXME: Verify if it shouldn't be PAL_BGR! */
|
/* FIXME: Verify if it shouldn't be PAL_BGR! */
|
||||||
XlateObj = (XLATEOBJ*)IntEngCreateXlate ( PAL_RGB, 0, NULL, Pal );
|
XlateObj = (XLATEOBJ*)IntEngCreateXlate(PAL_RGB, 0, NULL, Pal);
|
||||||
if ( XlateObj )
|
if (XlateObj)
|
||||||
{
|
{
|
||||||
// check if this DC has a DIB behind it...
|
// check if this DC has a DIB behind it...
|
||||||
if ( pso->pvScan0 ) // STYPE_BITMAP == pso->iType
|
if (pso->pvScan0) // STYPE_BITMAP == pso->iType
|
||||||
{
|
{
|
||||||
ASSERT ( pso->lDelta );
|
ASSERT(pso->lDelta);
|
||||||
Result = XLATEOBJ_iXlate(XlateObj,
|
Result = XLATEOBJ_iXlate(XlateObj,
|
||||||
DibFunctionsForBitmapFormat[pso->iBitmapFormat].DIB_GetPixel ( pso, XPos, YPos ) );
|
DibFunctionsForBitmapFormat[pso->iBitmapFormat].DIB_GetPixel(pso, XPos, YPos));
|
||||||
}
|
}
|
||||||
EngDeleteXlate(XlateObj);
|
EngDeleteXlate(XlateObj);
|
||||||
}
|
}
|
||||||
|
@ -387,15 +395,15 @@ NtGdiGetPixel(HDC hDC, INT XPos, INT YPos)
|
||||||
DC_UnlockDc(dc);
|
DC_UnlockDc(dc);
|
||||||
|
|
||||||
// if Result is still CLR_INVALID, then the "quick" method above didn't work
|
// if Result is still CLR_INVALID, then the "quick" method above didn't work
|
||||||
if ( bInRect && Result == CLR_INVALID )
|
if (bInRect && Result == CLR_INVALID)
|
||||||
{
|
{
|
||||||
// FIXME: create a 1x1 32BPP DIB, and blit to it
|
// FIXME: create a 1x1 32BPP DIB, and blit to it
|
||||||
HDC hDCTmp = NtGdiCreateCompatibleDC(hDC);
|
HDC hDCTmp = NtGdiCreateCompatibleDC(hDC);
|
||||||
if ( hDCTmp )
|
if (hDCTmp)
|
||||||
{
|
{
|
||||||
static const BITMAPINFOHEADER bih = { sizeof(BITMAPINFOHEADER), 1, 1, 1, 32, BI_RGB, 0, 0, 0, 0, 0 };
|
static const BITMAPINFOHEADER bih = { sizeof(BITMAPINFOHEADER), 1, 1, 1, 32, BI_RGB, 0, 0, 0, 0, 0 };
|
||||||
BITMAPINFO bi;
|
BITMAPINFO bi;
|
||||||
RtlMoveMemory ( &(bi.bmiHeader), &bih, sizeof(bih) );
|
RtlMoveMemory(&(bi.bmiHeader), &bih, sizeof(bih));
|
||||||
hBmpTmp = NtGdiCreateDIBitmapInternal(hDC,
|
hBmpTmp = NtGdiCreateDIBitmapInternal(hDC,
|
||||||
bi.bmiHeader.biWidth,
|
bi.bmiHeader.biWidth,
|
||||||
bi.bmiHeader.biHeight,
|
bi.bmiHeader.biHeight,
|
||||||
|
@ -408,29 +416,29 @@ NtGdiGetPixel(HDC hDC, INT XPos, INT YPos)
|
||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
//HBITMAP hBmpTmp = IntGdiCreateBitmap ( 1, 1, 1, 32, NULL);
|
//HBITMAP hBmpTmp = IntGdiCreateBitmap(1, 1, 1, 32, NULL);
|
||||||
if ( hBmpTmp )
|
if (hBmpTmp)
|
||||||
{
|
{
|
||||||
HBITMAP hBmpOld = (HBITMAP)NtGdiSelectBitmap ( hDCTmp, hBmpTmp );
|
HBITMAP hBmpOld = (HBITMAP)NtGdiSelectBitmap(hDCTmp, hBmpTmp);
|
||||||
if ( hBmpOld )
|
if (hBmpOld)
|
||||||
{
|
{
|
||||||
PSURFACE psurf;
|
PSURFACE psurf;
|
||||||
|
|
||||||
NtGdiBitBlt ( hDCTmp, 0, 0, 1, 1, hDC, XPos, YPos, SRCCOPY, 0, 0 );
|
NtGdiBitBlt(hDCTmp, 0, 0, 1, 1, hDC, XPos, YPos, SRCCOPY, 0, 0);
|
||||||
NtGdiSelectBitmap ( hDCTmp, hBmpOld );
|
NtGdiSelectBitmap(hDCTmp, hBmpOld);
|
||||||
|
|
||||||
// our bitmap is no longer selected, so we can access it's stuff...
|
// our bitmap is no longer selected, so we can access it's stuff...
|
||||||
psurf = SURFACE_LockSurface(hBmpTmp);
|
psurf = SURFACE_LockSurface(hBmpTmp);
|
||||||
if ( psurf )
|
if (psurf)
|
||||||
{
|
{
|
||||||
// Dont you need to convert something here?
|
// Dont you need to convert something here?
|
||||||
Result = *(COLORREF*)psurf->SurfObj.pvScan0;
|
Result = *(COLORREF*)psurf->SurfObj.pvScan0;
|
||||||
SURFACE_UnlockSurface(psurf);
|
SURFACE_UnlockSurface(psurf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NtGdiDeleteObject ( hBmpTmp );
|
NtGdiDeleteObject(hBmpTmp);
|
||||||
}
|
}
|
||||||
NtGdiDeleteObjectApp ( hDCTmp );
|
NtGdiDeleteObjectApp(hDCTmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,12 +461,15 @@ IntGetBitmapBits(
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* FIXME: Call DDI CopyBits here if available */
|
/* FIXME: Call DDI CopyBits here if available */
|
||||||
if(psurf->DDBitmap)
|
if (psurf->DDBitmap)
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
@ -536,16 +549,19 @@ IntSetBitmapBits(
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* FIXME: call DDI specific function here if available */
|
/* FIXME: call DDI specific function here if available */
|
||||||
if(psurf->DDBitmap)
|
if (psurf->DDBitmap)
|
||||||
{
|
{
|
||||||
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
|
||||||
{
|
{
|
||||||
DPRINT ("BitmapBits == NULL??\n");
|
DPRINT("BitmapBits == NULL??\n");
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,17 +690,17 @@ NtGdiSetPixel(
|
||||||
INT Y,
|
INT Y,
|
||||||
COLORREF Color)
|
COLORREF Color)
|
||||||
{
|
{
|
||||||
DPRINT("0 NtGdiSetPixel X %ld Y %ld C %ld\n",X,Y,Color);
|
DPRINT("0 NtGdiSetPixel X %ld Y %ld C %ld\n", X, Y, Color);
|
||||||
|
|
||||||
if (GdiSetPixelV(hDC,X,Y,Color))
|
if (GdiSetPixelV(hDC,X,Y,Color))
|
||||||
{
|
{
|
||||||
Color = NtGdiGetPixel(hDC,X,Y);
|
Color = NtGdiGetPixel(hDC,X,Y);
|
||||||
DPRINT("1 NtGdiSetPixel X %ld Y %ld C %ld\n",X,Y,Color);
|
DPRINT("1 NtGdiSetPixel X %ld Y %ld C %ld\n", X, Y, Color);
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -708,10 +727,10 @@ BITMAP_GetRealBitsPixel(UINT nBitsPixel)
|
||||||
}
|
}
|
||||||
|
|
||||||
INT FASTCALL
|
INT FASTCALL
|
||||||
BITMAP_GetWidthBytes (INT bmWidth, INT bpp)
|
BITMAP_GetWidthBytes(INT bmWidth, INT bpp)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
switch(bpp)
|
switch (bpp)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
return 2 * ((bmWidth+15) >> 4);
|
return 2 * ((bmWidth+15) >> 4);
|
||||||
|
@ -773,14 +792,16 @@ BITMAP_CopyBitmap(HBITMAP hBitmap)
|
||||||
(bm.bmHeight < 0 ? BMF_TOPDOWN : 0) | BMF_NOZEROINIT,
|
(bm.bmHeight < 0 ? BMF_TOPDOWN : 0) | BMF_NOZEROINIT,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if(res)
|
if (res)
|
||||||
{
|
{
|
||||||
PBYTE buf;
|
PBYTE buf;
|
||||||
|
|
||||||
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);
|
||||||
|
@ -788,9 +809,9 @@ BITMAP_CopyBitmap(HBITMAP hBitmap)
|
||||||
NtGdiDeleteObject(res);
|
NtGdiDeleteObject(res);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
IntGetBitmapBits (Bitmap, bm.bmWidthBytes * abs(bm.bmHeight), buf);
|
IntGetBitmapBits(Bitmap, bm.bmWidthBytes * abs(bm.bmHeight), buf);
|
||||||
IntSetBitmapBits (resBitmap, bm.bmWidthBytes * abs(bm.bmHeight), buf);
|
IntSetBitmapBits(resBitmap, bm.bmWidthBytes * abs(bm.bmHeight), buf);
|
||||||
ExFreePoolWithTag (buf,TAG_BITMAP);
|
ExFreePoolWithTag(buf,TAG_BITMAP);
|
||||||
resBitmap->flFlags = Bitmap->flFlags;
|
resBitmap->flFlags = Bitmap->flFlags;
|
||||||
GDIOBJ_UnlockObjByPtr((POBJ)resBitmap);
|
GDIOBJ_UnlockObjByPtr((POBJ)resBitmap);
|
||||||
}
|
}
|
||||||
|
@ -824,7 +845,7 @@ BITMAP_GetObject(SURFACE *psurf, INT Count, LPVOID buffer)
|
||||||
pBitmap->bmBitsPixel = BitsPerFormat(psurf->SurfObj.iBitmapFormat);
|
pBitmap->bmBitsPixel = BitsPerFormat(psurf->SurfObj.iBitmapFormat);
|
||||||
|
|
||||||
/* Check for DIB section */
|
/* Check for DIB section */
|
||||||
if(psurf->hSecure)
|
if (psurf->hSecure)
|
||||||
{
|
{
|
||||||
/* Set bmBits in this case */
|
/* Set bmBits in this case */
|
||||||
pBitmap->bmBits = psurf->SurfObj.pvBits;
|
pBitmap->bmBits = psurf->SurfObj.pvBits;
|
||||||
|
@ -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);
|
||||||
|
@ -906,7 +928,7 @@ NtGdiSelectBitmap(
|
||||||
}
|
}
|
||||||
|
|
||||||
pDc_Attr = pDC->pDc_Attr;
|
pDc_Attr = pDC->pDc_Attr;
|
||||||
if(!pDc_Attr) pDc_Attr = &pDC->Dc_Attr;
|
if (!pDc_Attr) pDc_Attr = &pDC->Dc_Attr;
|
||||||
|
|
||||||
/* must be memory dc to select bitmap */
|
/* must be memory dc to select bitmap */
|
||||||
if (pDC->DC_Type != DC_TYPE_MEMORY)
|
if (pDC->DC_Type != DC_TYPE_MEMORY)
|
||||||
|
@ -930,8 +952,9 @@ 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
|
||||||
if(psurfBmp->hSecure)
|
// [fixme: only create if the selected palette is null]
|
||||||
|
if (psurfBmp->hSecure)
|
||||||
{
|
{
|
||||||
// pDC->w.bitsPerPixel = psurfBmp->dib->dsBmih.biBitCount; ???
|
// pDC->w.bitsPerPixel = psurfBmp->dib->dsBmih.biBitCount; ???
|
||||||
pDC->w.bitsPerPixel = BitsPerFormat(psurfBmp->SurfObj.iBitmapFormat);
|
pDC->w.bitsPerPixel = BitsPerFormat(psurfBmp->SurfObj.iBitmapFormat);
|
||||||
|
@ -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…
Reference in a new issue