Vincent Povirk : windowscodecs: Simplify the BMP GetSize code and fix for top-down dibs.
Alexandre Julliard
julliard at winehq.org
Thu Jul 2 08:25:04 CDT 2009
Module: wine
Branch: master
Commit: 07538b79cbec7c398de9707eea4ef21a376cd90b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=07538b79cbec7c398de9707eea4ef21a376cd90b
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Wed Jul 1 15:53:47 2009 -0500
windowscodecs: Simplify the BMP GetSize code and fix for top-down dibs.
---
dlls/windowscodecs/bmpdecode.c | 36 ++++++++++++------------------------
1 files changed, 12 insertions(+), 24 deletions(-)
diff --git a/dlls/windowscodecs/bmpdecode.c b/dlls/windowscodecs/bmpdecode.c
index 46b2527..8391a1b 100644
--- a/dlls/windowscodecs/bmpdecode.c
+++ b/dlls/windowscodecs/bmpdecode.c
@@ -118,36 +118,24 @@ static ULONG WINAPI BmpFrameDecode_Release(IWICBitmapFrameDecode *iface)
return ref;
}
-static HRESULT BmpHeader_GetSize(BITMAPV5HEADER *bih, UINT *puiWidth, UINT *puiHeight)
-{
- switch (bih->bV5Size)
- {
- case sizeof(BITMAPCOREHEADER):
- {
- BITMAPCOREHEADER *bch = (BITMAPCOREHEADER*)bih;
- *puiWidth = bch->bcWidth;
- *puiHeight = bch->bcHeight;
- return S_OK;
- }
- case sizeof(BITMAPCOREHEADER2):
- case sizeof(BITMAPINFOHEADER):
- case sizeof(BITMAPV4HEADER):
- case sizeof(BITMAPV5HEADER):
- *puiWidth = bih->bV5Width;
- *puiHeight = bih->bV5Height;
- return S_OK;
- default:
- return E_FAIL;
- }
-}
-
static HRESULT WINAPI BmpFrameDecode_GetSize(IWICBitmapFrameDecode *iface,
UINT *puiWidth, UINT *puiHeight)
{
BmpFrameDecode *This = (BmpFrameDecode*)iface;
TRACE("(%p,%p,%p)\n", iface, puiWidth, puiHeight);
- return BmpHeader_GetSize(&This->bih, puiWidth, puiHeight);
+ if (This->bih.bV5Size == sizeof(BITMAPCOREHEADER))
+ {
+ BITMAPCOREHEADER *bch = (BITMAPCOREHEADER*)&This->bih;
+ *puiWidth = bch->bcWidth;
+ *puiHeight = bch->bcHeight;
+ }
+ else
+ {
+ *puiWidth = This->bih.bV5Width;
+ *puiHeight = abs(This->bih.bV5Height);
+ }
+ return S_OK;
}
static HRESULT WINAPI BmpFrameDecode_GetPixelFormat(IWICBitmapFrameDecode *iface,
More information about the wine-cvs
mailing list