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



commit db18c1f172be871fd5758d7d8ee6da447468696f
Author: Mukund Sivaraman <muks banu com>
Date:   Fri Oct 3 11:10:26 2014 +0530

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

 plug-ins/file-bmp/bmp-write.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/plug-ins/file-bmp/bmp-write.c b/plug-ins/file-bmp/bmp-write.c
index 1beaf0c..500ad93 100644
--- a/plug-ins/file-bmp/bmp-write.c
+++ b/plug-ins/file-bmp/bmp-write.c
@@ -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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]