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

Function iLoadBitmapInternal

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

Internal function used to load the .bmp.

Source from the content-addressed store, hash-verified

212
213// Internal function used to load the .bmp.
214ILboolean iLoadBitmapInternal()
215{
216 BMPHEAD Header;
217 OS2_HEAD Os2Head;
218 ILboolean bBitmap;
219
220 if (iCurImage == NULL) {
221 ilSetError(IL_ILLEGAL_OPERATION);
222 return IL_FALSE;
223 }
224
225 iGetBmpHead(&Header);
226 if (!iCheckBmp(&Header)) {
227 iseek(-(ILint)sizeof(BMPHEAD), IL_SEEK_CUR);
228 iGetOS2Head(&Os2Head);
229 if (!iCheckOS2(&Os2Head)) {
230 ilSetError(IL_INVALID_FILE_HEADER);
231 return IL_FALSE;
232 }
233 else {
234 return iGetOS2Bmp(&Os2Head);
235 }
236 }
237
238 // Don't know what to do if it has more than one plane...
239 if (Header.biPlanes != 1) {
240 ilSetError(IL_INVALID_FILE_HEADER);
241 return IL_FALSE;
242 }
243
244 switch (Header.biCompression)
245 {
246 case 0: // No compression
247 case 3: // BITFIELDS compression is handled in 16 bit
248 // and 32 bit code in ilReadUncompBmp()
249 bBitmap = ilReadUncompBmp(&Header);
250 break;
251 case 1: // RLE 8-bit / pixel (BI_RLE8)
252 bBitmap = ilReadRLE8Bmp(&Header);
253 break;
254 case 2: // RLE 4-bit / pixel (BI_RLE4)
255 bBitmap = ilReadRLE4Bmp(&Header);
256 break;
257
258 default:
259 ilSetError(IL_INVALID_FILE_HEADER);
260 return IL_FALSE;
261 }
262
263 if (!ilFixImage())
264 return IL_FALSE;
265
266 return bBitmap;
267}
268
269
270// Reads an uncompressed .bmp

Callers 2

ilLoadBmpFFunction · 0.85
ilLoadBmpLFunction · 0.85

Calls 10

ilSetErrorFunction · 0.85
iGetBmpHeadFunction · 0.85
iCheckBmpFunction · 0.85
iGetOS2HeadFunction · 0.85
iCheckOS2Function · 0.85
iGetOS2BmpFunction · 0.85
ilReadUncompBmpFunction · 0.85
ilReadRLE8BmpFunction · 0.85
ilReadRLE4BmpFunction · 0.85
ilFixImageFunction · 0.85

Tested by

no test coverage detected