Author: tkreuzer
Date: Thu Jul 26 19:20:29 2007
New Revision: 27851
URL:
http://svn.reactos.org/svn/reactos?rev=27851&view=rev
Log:
- implement CreateBitmapIndirect, calling NtGdicreateBitmap
- NtGdiCreateBitmap: directly do the job instead of calling IntCreateBitmapIndirect
- remove IntCreateBitmapIndirect
- remove NtGdiCreateBitmapIndirect
- update ntgdibad.h
Modified:
trunk/reactos/dll/win32/gdi32/gdi32.def
trunk/reactos/dll/win32/gdi32/objects/bitmap.c
trunk/reactos/include/reactos/win32k/ntgdibad.h
trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c
trunk/reactos/tools/nci/w32ksvc.db
Modified: trunk/reactos/dll/win32/gdi32/gdi32.def
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/gdi32.def?…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/gdi32.def (original)
+++ trunk/reactos/dll/win32/gdi32/gdi32.def Thu Jul 26 19:20:29 2007
@@ -48,7 +48,7 @@
CopyMetaFileA@8
CopyMetaFileW@8
CreateBitmap@20=NtGdiCreateBitmap@20
-CreateBitmapIndirect@4=NtGdiCreateBitmapIndirect@4
+CreateBitmapIndirect@4
CreateBrushIndirect@4
CreateColorSpaceA@4
CreateColorSpaceW@4
Modified: trunk/reactos/dll/win32/gdi32/objects/bitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/bi…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/bitmap.c (original)
+++ trunk/reactos/dll/win32/gdi32/objects/bitmap.c Thu Jul 26 19:20:29 2007
@@ -84,3 +84,20 @@
return NtGdiBitBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest,
nHeightDest, hdcSrc, nXOriginSrc, nYOriginSrc, dwRop, 0, 0);
}
+
+/*
+ * @implemented
+ */
+HBITMAP WINAPI
+CreateBitmapIndirect(const BITMAP *pbm)
+{
+ if (pbm)
+ {
+ return NtGdiCreateBitmap(pbm->bmWidth,
+ pbm->bmHeight,
+ pbm->bmPlanes,
+ pbm->bmBitsPixel,
+ pbm->bmBits);
+ }
+ return NULL;
+}
Modified: trunk/reactos/include/reactos/win32k/ntgdibad.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntg…
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntgdibad.h (original)
+++ trunk/reactos/include/reactos/win32k/ntgdibad.h Thu Jul 26 19:20:29 2007
@@ -194,13 +194,6 @@
LPCWSTR File
);
-/* Use NtGdiCreateBitmap and expand the pbm-> */
-HBITMAP
-STDCALL
-NtGdiCreateBitmapIndirect (
- CONST BITMAP * BM
- );
-
/* Use NtGdiCreateDIBitmapInternal */
HBITMAP
STDCALL
Modified: trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c Thu Jul 26 19:20:29 2007
@@ -400,36 +400,42 @@
return Ret;
}
-static HBITMAP
-IntCreateBitmapIndirect(CONST BITMAP *BM)
+HBITMAP STDCALL
+NtGdiCreateBitmap(
+ INT Width,
+ INT Height,
+ UINT Planes,
+ UINT BitsPixel,
+ IN OPTIONAL LPBYTE Bits)
{
PBITMAPOBJ bmp;
HBITMAP hBitmap;
SIZEL Size;
- UINT BitsPixel;
+ LONG WidthBytes;
/* NOTE: Windows also doesn't store nr. of planes separately! */
- BitsPixel = BM->bmBitsPixel * BM->bmPlanes;
+ BitsPixel = BitsPixel * Planes;
+ WidthBytes = BITMAPOBJ_GetWidthBytes(Width, BitsPixel);
/* Check parameters */
- if (0 == BM->bmHeight || 0 == BM->bmWidth)
+ if (0 == Height || 0 == Width)
{
Size.cx = Size.cy = 1;
}
else
{
- Size.cx = abs(BM->bmWidth);
- Size.cy = abs(BM->bmHeight);
+ Size.cx = abs(Width);
+ Size.cy = abs(Height);
}
/* Create the bitmap object. */
- hBitmap = IntCreateBitmap(Size, BM->bmWidthBytes,
+ hBitmap = IntCreateBitmap(Size, WidthBytes,
BitmapFormat(BitsPixel, BI_RGB),
- (BM->bmHeight < 0 ? BMF_TOPDOWN : 0) |
- (NULL == BM->bmBits ? 0 : BMF_NOZEROINIT), NULL);
+ (Height < 0 ? BMF_TOPDOWN : 0) |
+ (NULL == Bits ? 0 : BMF_NOZEROINIT), NULL);
if (!hBitmap)
{
- DPRINT("NtGdiCreateBitmap: IntCreateBitmap returned 0\n");
+ DPRINT("NtGdiCreateBitmap: returned 0\n");
return 0;
}
@@ -452,33 +458,12 @@
* to us it should be safe.
*/
- if (NULL != BM->bmBits)
+ if (NULL != Bits)
{
- NtGdiSetBitmapBits(hBitmap, bmp->SurfObj.cjBits, BM->bmBits);
+ NtGdiSetBitmapBits(hBitmap, bmp->SurfObj.cjBits, Bits);
}
return hBitmap;
-}
-
-HBITMAP STDCALL
-NtGdiCreateBitmap(
- INT Width,
- INT Height,
- UINT Planes,
- UINT BitsPixel,
- IN OPTIONAL LPBYTE Bits)
-{
- BITMAP BM;
-
- BM.bmType = 0;
- BM.bmWidth = Width;
- BM.bmHeight = Height;
- BM.bmWidthBytes = BITMAPOBJ_GetWidthBytes(Width, Planes * BitsPixel);
- BM.bmPlanes = Planes;
- BM.bmBitsPixel = BitsPixel;
- BM.bmBits = Bits;
-
- return IntCreateBitmapIndirect(&BM);
}
BOOL INTERNAL_CALL
@@ -567,35 +552,6 @@
DPRINT ("\t\t%04x\n", Bmp);
DC_UnlockDc(Dc);
return Bmp;
-}
-
-HBITMAP STDCALL
-NtGdiCreateBitmapIndirect(CONST BITMAP *UnsafeBM)
-{
- BITMAP BM;
- NTSTATUS Status = STATUS_SUCCESS;
-
- _SEH_TRY
- {
- ProbeForRead(UnsafeBM, sizeof(BITMAP), 1);
- BM = *UnsafeBM;
- if (NULL != BM.bmBits)
- {
- ProbeForRead(BM.bmBits, BM.bmWidthBytes * abs(BM.bmHeight), 2);
- }
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
- if(!NT_SUCCESS(Status))
- {
- SetLastNtError(Status);
- return NULL;
- }
-
- return IntCreateBitmapIndirect(&BM);
}
HBITMAP STDCALL
@@ -1546,7 +1502,11 @@
if (Bitmap->SurfObj.lDelta >= 0)
bm.bmHeight = -bm.bmHeight;
- res = IntCreateBitmapIndirect(&bm);
+ res = NtGdiCreateBitmap(bm.bmWidth,
+ bm.bmHeight,
+ bm.bmPlanes,
+ bm.bmBitsPixel,
+ bm.bmBits);
if(res)
{
PBYTE buf;
Modified: trunk/reactos/tools/nci/w32ksvc.db
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/nci/w32ksvc.db?rev=2…
==============================================================================
--- trunk/reactos/tools/nci/w32ksvc.db (original)
+++ trunk/reactos/tools/nci/w32ksvc.db Thu Jul 26 19:20:29 2007
@@ -21,7 +21,6 @@
NtGdiCopyEnhMetaFile 2
NtGdiCopyMetaFile 2
NtGdiCreateBitmap 5
-NtGdiCreateBitmapIndirect 1
NtGdiCreateColorSpace 1
NtGdiCreateCompatibleBitmap 3
NtGdiCreateCompatibleDC 1