MCPcopy Create free account
hub / github.com/DentonW/DevIL / iCheckBmp

Function iCheckBmp

DevIL/src-IL/src/il_bmp.cpp:135–153  ·  view source on GitHub ↗

Internal function used to check if the HEADER is a valid .bmp header.

Source from the content-addressed store, hash-verified

133
134// Internal function used to check if the HEADER is a valid .bmp header.
135ILboolean iCheckBmp (const BMPHEAD * CONST_RESTRICT Header)
136{
137 //if ((Header->bfType != ('B'|('M'<<8))) || ((Header->biSize != 0x28) && (Header->biSize != 0x0C)))
138 if ((Header->bfType != ('B'|('M'<<8))) || (Header->biSize != 0x28))
139 return IL_FALSE;
140 if (Header->biHeight == 0 || Header->biWidth < 1)
141 return IL_FALSE;
142 if (Header->biPlanes > 1) // Not sure...
143 return IL_FALSE;
144 if(Header->biCompression != 0 && Header->biCompression != 1 &&
145 Header->biCompression != 2 && Header->biCompression != 3)
146 return IL_FALSE;
147 if(Header->biCompression == 3 && Header->biBitCount != 16 && Header->biBitCount != 32)
148 return IL_FALSE;
149 if (Header->biBitCount != 1 && Header->biBitCount != 4 && Header->biBitCount != 8 &&
150 Header->biBitCount != 16 && Header->biBitCount != 24 && Header->biBitCount != 32)
151 return IL_FALSE;
152 return IL_TRUE;
153}
154
155
156ILboolean iCheckOS2 (const OS2_HEAD * CONST_RESTRICT Header)

Callers 2

iIsValidBmpFunction · 0.85
iLoadBitmapInternalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected