From b92cf193fb9a910da3ad0b93d221dc2e02c9d535 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Sun, 30 Nov 2008 13:17:19 +0000 Subject: [PATCH] - Sync in rev 37720: Magnus Olsen, add GdiGetBitmapBitsSize is a new api from windows xp sp3, the code was tested in vs2003. svn path=/trunk/; revision=37766 --- reactos/dll/win32/gdi32/objects/bitmap.c | 44 ++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/gdi32/objects/bitmap.c b/reactos/dll/win32/gdi32/objects/bitmap.c index ff68b08264a..e0e5f3a8e09 100644 --- a/reactos/dll/win32/gdi32/objects/bitmap.c +++ b/reactos/dll/win32/gdi32/objects/bitmap.c @@ -125,6 +125,48 @@ DIB_GetBitmapInfo(const BITMAPINFOHEADER *header, return -1; } +/* + * @implemented + */ +int +WINAPI +GdiGetBitmapBitsSize(BITMAPINFO *lpbmi) +{ + int retSize; + + if (lpbmi->bmiHeader.biSize == FIELD_OFFSET(BITMAPINFOHEADER, biPlanes)) + { + /* Calc the bits Size and align it*/ + retSize = HIWORD(lpbmi->bmiHeader.biWidth) * ((LOWORD(lpbmi->bmiHeader.biWidth) * + LOWORD(lpbmi->bmiHeader.biHeight) * HIWORD(lpbmi->bmiHeader.biHeight) + 31) + & -32) / 8; + } + else + { + if ( (lpbmi->bmiHeader.biCompression == BI_BITFIELDS) || + (lpbmi->bmiHeader.biCompression == BI_RGB)) + { + if (lpbmi->bmiHeader.biHeight >=0 ) + { + /* Calc the bits Size and align it*/ + retSize = lpbmi->bmiHeader.biHeight * ((lpbmi->bmiHeader.biWidth * + lpbmi->bmiHeader.biPlanes * lpbmi->bmiHeader.biBitCount + 31) & -32) / 8; + } + else + { + /* Make height postiive if it negitve then calc the bits Size and align it*/ + retSize = (-lpbmi->bmiHeader.biHeight) * ((lpbmi->bmiHeader.biWidth * + lpbmi->bmiHeader.biPlanes * lpbmi->bmiHeader.biBitCount + 31) & -32) / 8; + } + } + else + { + retSize = lpbmi->bmiHeader.biSizeImage; + } + } + return retSize; +} + /* * @implemented */ @@ -180,8 +222,6 @@ CreateDIBSection( } - - /* * @implemented */