Author: tkreuzer
Date: Wed Mar 25 22:27:16 2015
New Revision: 66885
URL:
http://svn.reactos.org/svn/reactos?rev=66885&view=rev
Log:
[WIN32K]
Implement GreCreateDIBitmapFromPackedDIB
Modified:
trunk/reactos/win32ss/gdi/ntgdi/dib.h
trunk/reactos/win32ss/gdi/ntgdi/dibobj.c
Modified: trunk/reactos/win32ss/gdi/ntgdi/dib.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dib.h?re…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/dib.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/dib.h [iso-8859-1] Wed Mar 25 22:27:16 2015
@@ -26,4 +26,11 @@
UINT MaxBits,
UINT MaxInfo);
+HBITMAP
+NTAPI
+GreCreateDIBitmapFromPackedDIB(
+ _In_reads_(cjPackedDIB )PVOID pvPackedDIB,
+ _In_ UINT cjPackedDIB,
+ _In_ ULONG uUsage);
+
#define DIB_PAL_BRUSHHACK 3
Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dibobj.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] Wed Mar 25 22:27:16 2015
@@ -1539,6 +1539,56 @@
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