mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 12:55:43 +00:00
[WIN32K]
Implement GreCreateDIBitmapFromPackedDIB svn path=/trunk/; revision=66885
This commit is contained in:
parent
1ddbcff3ca
commit
5528fd245a
2 changed files with 57 additions and 0 deletions
|
@ -26,4 +26,11 @@ GreGetDIBitsInternal(
|
|||
UINT MaxBits,
|
||||
UINT MaxInfo);
|
||||
|
||||
HBITMAP
|
||||
NTAPI
|
||||
GreCreateDIBitmapFromPackedDIB(
|
||||
_In_reads_(cjPackedDIB )PVOID pvPackedDIB,
|
||||
_In_ UINT cjPackedDIB,
|
||||
_In_ ULONG uUsage);
|
||||
|
||||
#define DIB_PAL_BRUSHHACK 3
|
||||
|
|
|
@ -1539,6 +1539,56 @@ GreCreateDIBitmapInternal(
|
|||
return Bmp;
|
||||
}
|
||||
|
||||
HBITMAP
|
||||
NTAPI
|
||||
GreCreateDIBitmapFromPackedDIB(
|
||||
_In_reads_(cjPackedDIB )PVOID pvPackedDIB,
|
||||
_In_ UINT cjPackedDIB,
|
||||
_In_ ULONG uUsage)
|
||||
{
|
||||
PBITMAPINFO pbmi;
|
||||
PBYTE pjBits;
|
||||
UINT cjInfo, cjBits;
|
||||
HBITMAP hbm;
|
||||
|
||||
/* We only support BITMAPINFOHEADER, make sure the size is ok */
|
||||
if (cjPackedDIB < sizeof(BITMAPINFOHEADER))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* The packed DIB starts with the BITMAPINFOHEADER */
|
||||
pbmi = pvPackedDIB;
|
||||
|
||||
if (cjPackedDIB < pbmi->bmiHeader.biSize)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Calculate the info size and make sure the packed DIB is large enough */
|
||||
cjInfo = DIB_BitmapInfoSize(pbmi, uUsage);
|
||||
if (cjPackedDIB <= cjInfo)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* The bitmap bits start after the header */
|
||||
pjBits = (PBYTE)pvPackedDIB + cjInfo;
|
||||
cjBits = cjPackedDIB - cjInfo;
|
||||
|
||||
hbm = GreCreateDIBitmapInternal(NULL,
|
||||
pbmi->bmiHeader.biWidth,
|
||||
abs(pbmi->bmiHeader.biHeight),
|
||||
CBM_INIT | CBM_CREATDIB,
|
||||
pjBits,
|
||||
pbmi,
|
||||
uUsage,
|
||||
0,
|
||||
cjBits,
|
||||
NULL);
|
||||
|
||||
return hbm;
|
||||
}
|
||||
|
||||
HBITMAP
|
||||
APIENTRY
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue