Commit db18c1f1 authored by Mukund Sivaraman's avatar Mukund Sivaraman

file-bmp: Fix final bfSize patched into BMP header (#737669)

parent dbfbc221
......@@ -72,7 +72,9 @@ static void write_image (FILE *f,
gint bpp,
gint spzeile,
gint MapSize,
RGBMode rgb_format);
RGBMode rgb_format,
gint mask_info_size,
gint color_space_size);
static gboolean save_dialog (gint channels);
......@@ -354,9 +356,10 @@ WriteBMP (const gchar *filename,
else
SpZeile = ((gint) (((Spcols * BitsPerPixel) / 8) / 4) + 1) * 4;
color_space_size = 0;
if (! BMPSaveData.dont_write_color_space_data)
color_space_size = 68;
else
color_space_size = 0;
Bitmap_File_Head.bfSize = (0x36 + MapSize + (rows * SpZeile) +
mask_info_size + color_space_size);
......@@ -541,7 +544,8 @@ WriteBMP (const gchar *filename,
pixels, cols, rows,
BMPSaveData.use_run_length_encoding,
channels, BitsPerPixel, SpZeile,
MapSize, BMPSaveData.rgb_format);
MapSize, BMPSaveData.rgb_format,
mask_info_size, color_space_size);
/* ... and exit normally */
......@@ -582,7 +586,9 @@ write_image (FILE *f,
gint bpp,
gint spzeile,
gint MapSize,
RGBMode rgb_format)
RGBMode rgb_format,
gint mask_info_size,
gint color_space_size)
{
guchar buf[16] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0 };
guchar puffer[8];
......@@ -830,7 +836,7 @@ write_image (FILE *f,
FromL (length, puffer);
Write (f, puffer, 4);
fseek (f, 0x02, SEEK_SET); /* Write length of file */
length += (0x36 + MapSize);
length += (0x36 + MapSize + mask_info_size + color_space_size);
FromL (length, puffer);
Write (f, puffer, 4);
g_free (ketten);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment