Merge pull request #93 from Foxar/feature/bmploader_colordataoffset

bmp_loader: Auto skipping of color table information.
This commit is contained in:
Sandro Sobczyński
2021-04-23 20:02:09 +02:00
committed by GitHub
+4
View File
@@ -51,6 +51,7 @@ void BmpLoader::load(Texture &o_texture, char *t_subfolder, char *t_name, char *
u32 width = (u32)header[18]; u32 width = (u32)header[18];
u32 height = (u32)header[22]; u32 height = (u32)header[22];
u32 bits = (u32)header[28]; u32 bits = (u32)header[28];
u32 dataOffset = (u32)header[10];
if (bits != 24) if (bits != 24)
{ {
@@ -64,6 +65,9 @@ void BmpLoader::load(Texture &o_texture, char *t_subfolder, char *t_name, char *
unsigned char row[rowPadded]; unsigned char row[rowPadded];
//Offset file stream to raster data
fseek(file, dataOffset, SEEK_SET);
u32 x = 0; u32 x = 0;
for (u32 i = 0; i < height; i++) for (u32 i = 0; i < height; i++)
{ {