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



commit ba410efe363adf627cc710575de181cd90506382
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)
    
    (cherry picked from commit db18c1f172be871fd5758d7d8ee6da447468696f)

 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 3465297..8f6a283 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);
 
@@ -338,9 +340,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);
@@ -525,7 +528,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 */
 
@@ -567,7 +571,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];
@@ -815,7 +821,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]