mirror of
https://github.com/reactos/reactos.git
synced 2024-09-02 16:48:36 +00:00
Patch by Stefan Ginsberg (stefan__100__ AT hotmail DOT com): Win32k half: Remove NtGdiSetDIBits, all related files updated.include
svn path=/trunk/; revision=33029
This commit is contained in:
parent
9f9e67d83d
commit
96f8e3dc83
|
@ -23,7 +23,7 @@ typedef struct _BITMAPOBJ
|
||||||
/* For device-independent bitmaps: */
|
/* For device-independent bitmaps: */
|
||||||
DIBSECTION *dib;
|
DIBSECTION *dib;
|
||||||
HPALETTE hDIBPalette;
|
HPALETTE hDIBPalette;
|
||||||
HDC hDC;
|
HDC hDC; // Doc in "Undocumented Windows", page 546, seems to be supported with XP.
|
||||||
} BITMAPOBJ, *PBITMAPOBJ;
|
} BITMAPOBJ, *PBITMAPOBJ;
|
||||||
|
|
||||||
#define BITMAPOBJ_IS_APIBITMAP 0x1
|
#define BITMAPOBJ_IS_APIBITMAP 0x1
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* $Id$
|
|
||||||
*
|
*
|
||||||
* ReactOS W32 Subsystem
|
* ReactOS W32 Subsystem
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
||||||
|
@ -277,39 +276,6 @@ IntSetDIBits(
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Converts a DIB to a device-dependent bitmap
|
|
||||||
INT STDCALL
|
|
||||||
NtGdiSetDIBits(
|
|
||||||
HDC hDC,
|
|
||||||
HBITMAP hBitmap,
|
|
||||||
UINT StartScan,
|
|
||||||
UINT ScanLines,
|
|
||||||
CONST VOID *Bits,
|
|
||||||
CONST BITMAPINFO *bmi,
|
|
||||||
UINT ColorUse)
|
|
||||||
{
|
|
||||||
PDC Dc;
|
|
||||||
INT Ret;
|
|
||||||
|
|
||||||
Dc = DC_LockDc(hDC);
|
|
||||||
if (NULL == Dc)
|
|
||||||
{
|
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (Dc->DC_Type == DC_TYPE_INFO)
|
|
||||||
{
|
|
||||||
DC_UnlockDc(Dc);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ret = IntSetDIBits(Dc, hBitmap, StartScan, ScanLines, Bits, bmi, ColorUse);
|
|
||||||
|
|
||||||
DC_UnlockDc(Dc);
|
|
||||||
|
|
||||||
return Ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
W32KAPI
|
W32KAPI
|
||||||
INT
|
INT
|
||||||
APIENTRY
|
APIENTRY
|
||||||
|
@ -335,13 +301,16 @@ NtGdiSetDIBitsToDeviceInternal(
|
||||||
INT ret = 0;
|
INT ret = 0;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
PDC pDC;
|
PDC pDC;
|
||||||
HBITMAP hSourceBitmap;
|
HBITMAP hSourceBitmap = NULL;
|
||||||
SURFOBJ *pDestSurf, *pSourceSurf;
|
SURFOBJ *pDestSurf, *pSourceSurf = NULL;
|
||||||
RECTL rcDest;
|
RECTL rcDest;
|
||||||
POINTL ptSource;
|
POINTL ptSource;
|
||||||
INT DIBWidth;
|
INT DIBWidth;
|
||||||
SIZEL SourceSize;
|
SIZEL SourceSize;
|
||||||
XLATEOBJ *XlateObj = NULL;
|
XLATEOBJ *XlateObj = NULL;
|
||||||
|
PPALGDI pDCPalette;
|
||||||
|
HPALETTE DDBPalette, DIBPalette = NULL;
|
||||||
|
ULONG DDBPaletteType, DIBPaletteType;
|
||||||
|
|
||||||
if (!Bits) return 0;
|
if (!Bits) return 0;
|
||||||
|
|
||||||
|
@ -365,10 +334,6 @@ NtGdiSetDIBitsToDeviceInternal(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceSize.cx = bmi->bmiHeader.biWidth;
|
|
||||||
SourceSize.cy = ScanLines;
|
|
||||||
DIBWidth = DIB_GetDIBWidthBytes(SourceSize.cx, bmi->bmiHeader.biBitCount);
|
|
||||||
|
|
||||||
rcDest.left = XDest;
|
rcDest.left = XDest;
|
||||||
rcDest.top = YDest;
|
rcDest.top = YDest;
|
||||||
rcDest.right = XDest + Width;
|
rcDest.right = XDest + Width;
|
||||||
|
@ -379,6 +344,10 @@ NtGdiSetDIBitsToDeviceInternal(
|
||||||
/* Enter SEH, as the bits are user mode */
|
/* Enter SEH, as the bits are user mode */
|
||||||
_SEH_TRY
|
_SEH_TRY
|
||||||
{
|
{
|
||||||
|
SourceSize.cx = bmi->bmiHeader.biWidth;
|
||||||
|
SourceSize.cy = ScanLines;
|
||||||
|
DIBWidth = DIB_GetDIBWidthBytes(SourceSize.cx, bmi->bmiHeader.biBitCount);
|
||||||
|
|
||||||
ProbeForRead(Bits, DIBWidth * abs(bmi->bmiHeader.biHeight), 1);
|
ProbeForRead(Bits, DIBWidth * abs(bmi->bmiHeader.biHeight), 1);
|
||||||
hSourceBitmap = EngCreateBitmap(SourceSize,
|
hSourceBitmap = EngCreateBitmap(SourceSize,
|
||||||
DIBWidth,
|
DIBWidth,
|
||||||
|
@ -395,13 +364,39 @@ NtGdiSetDIBitsToDeviceInternal(
|
||||||
pSourceSurf = EngLockSurface((HSURF)hSourceBitmap);
|
pSourceSurf = EngLockSurface((HSURF)hSourceBitmap);
|
||||||
if (!pSourceSurf)
|
if (!pSourceSurf)
|
||||||
{
|
{
|
||||||
EngDeleteSurface((HSURF)hSourceBitmap);
|
|
||||||
Status = STATUS_UNSUCCESSFUL;
|
Status = STATUS_UNSUCCESSFUL;
|
||||||
_SEH_LEAVE;
|
_SEH_LEAVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: handle XlateObj */
|
|
||||||
XlateObj = NULL;
|
/* Obtain destination palette from the DC */
|
||||||
|
pDCPalette = PALETTE_LockPalette(((GDIDEVICE *)pDC->pPDev)->DevInfo.hpalDefault);
|
||||||
|
if (!pDCPalette)
|
||||||
|
{
|
||||||
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
|
Status = STATUS_UNSUCCESSFUL;
|
||||||
|
_SEH_LEAVE;
|
||||||
|
}
|
||||||
|
DDBPaletteType = pDCPalette->Mode;
|
||||||
|
DDBPalette = ((GDIDEVICE *)pDC->pPDev)->DevInfo.hpalDefault;
|
||||||
|
PALETTE_UnlockPalette(pDCPalette);
|
||||||
|
|
||||||
|
DIBPalette = BuildDIBPalette(bmi, (PINT)&DIBPaletteType);
|
||||||
|
if (!DIBPalette)
|
||||||
|
{
|
||||||
|
SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
|
||||||
|
Status = STATUS_NO_MEMORY;
|
||||||
|
_SEH_LEAVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Determine XlateObj */
|
||||||
|
XlateObj = IntEngCreateXlate(DDBPaletteType, DIBPaletteType, DDBPalette, DIBPalette);
|
||||||
|
if (!XlateObj)
|
||||||
|
{
|
||||||
|
SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
|
||||||
|
Status = STATUS_NO_MEMORY;
|
||||||
|
_SEH_LEAVE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Copy the bits */
|
/* Copy the bits */
|
||||||
Status = IntEngBitBlt(pDestSurf,
|
Status = IntEngBitBlt(pDestSurf,
|
||||||
|
@ -416,8 +411,6 @@ NtGdiSetDIBitsToDeviceInternal(
|
||||||
NULL,
|
NULL,
|
||||||
ROP3_TO_ROP4(SRCCOPY));
|
ROP3_TO_ROP4(SRCCOPY));
|
||||||
|
|
||||||
EngUnlockSurface(pSourceSurf);
|
|
||||||
EngDeleteSurface((HSURF)hSourceBitmap);
|
|
||||||
}
|
}
|
||||||
_SEH_HANDLE
|
_SEH_HANDLE
|
||||||
{
|
{
|
||||||
|
@ -431,6 +424,10 @@ NtGdiSetDIBitsToDeviceInternal(
|
||||||
ret = ScanLines;
|
ret = ScanLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pSourceSurf) EngUnlockSurface(pSourceSurf);
|
||||||
|
if (hSourceBitmap) EngDeleteSurface((HSURF)hSourceBitmap);
|
||||||
|
if (XlateObj) EngDeleteXlate(XlateObj);
|
||||||
|
if (DIBPalette) PALETTE_FreePaletteByHandle(DIBPalette);
|
||||||
EngUnlockSurface(pDestSurf);
|
EngUnlockSurface(pDestSurf);
|
||||||
DC_UnlockDc(pDC);
|
DC_UnlockDc(pDC);
|
||||||
|
|
||||||
|
@ -745,6 +742,7 @@ NtGdiStretchDIBitsInternal(
|
||||||
HBITMAP hBitmap, hOldBitmap;
|
HBITMAP hBitmap, hOldBitmap;
|
||||||
HDC hdcMem;
|
HDC hdcMem;
|
||||||
HPALETTE hPal = NULL;
|
HPALETTE hPal = NULL;
|
||||||
|
PDC pDC;
|
||||||
|
|
||||||
if (!Bits || !BitsInfo)
|
if (!Bits || !BitsInfo)
|
||||||
{
|
{
|
||||||
|
@ -776,8 +774,13 @@ NtGdiStretchDIBitsInternal(
|
||||||
ROP, 0);
|
ROP, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
NtGdiSetDIBits(hdcMem, hBitmap, 0, BitsInfo->bmiHeader.biHeight, Bits,
|
pDC = DC_LockDc(hdcMem);
|
||||||
BitsInfo, (UINT)Usage);
|
|
||||||
|
IntSetDIBits(pDC, hBitmap, 0, BitsInfo->bmiHeader.biHeight, Bits,
|
||||||
|
BitsInfo, Usage);
|
||||||
|
|
||||||
|
DC_UnlockDc(pDC);
|
||||||
|
|
||||||
|
|
||||||
/* Origin for DIBitmap may be bottom left (positive biHeight) or top
|
/* Origin for DIBitmap may be bottom left (positive biHeight) or top
|
||||||
left (negative biHeight) */
|
left (negative biHeight) */
|
||||||
|
|
|
@ -674,7 +674,6 @@ NtGdiDrawStream 3
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#ReactOS specific syscalls
|
#ReactOS specific syscalls
|
||||||
NtGdiSetDIBits 7
|
|
||||||
NtGdiSetViewportExtEx 4
|
NtGdiSetViewportExtEx 4
|
||||||
NtGdiSetViewportOrgEx 4
|
NtGdiSetViewportOrgEx 4
|
||||||
NtGdiSetWindowExtEx 4
|
NtGdiSetWindowExtEx 4
|
||||||
|
|
Loading…
Reference in a new issue