[gnumeric] Add bmp header to dib image objects data



commit a6d518e2d513bb02215cda4649a4c35a859060db
Author: Hans de Goede <hdegoede redhat com>
Date:   Wed Nov 3 00:30:19 2010 +0100

    Add bmp header to dib image objects data
    
    Signed-off-by: J.H.M. Dassen (Ray) <jdassen debian org>

 plugins/excel/ms-excel-read.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index b155e8d..8da41fc 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -663,10 +663,20 @@ ms_sheet_realize_obj (MSContainer *container, MSObj *obj)
 			MSEscherBlip *blip = ms_container_get_blip (container,
 				attr->v.v_uint - 1);
 			if (blip != NULL) {
-				sheet_object_image_set_image (SHEET_OBJECT_IMAGE (so),
-					blip->type, blip->data, blip->data_len,
-					!blip->needs_free);
-				blip->needs_free = FALSE; /* image took over managing data */
+			        if (blip->type && !strcmp (blip->type, "dib")) {
+					guint8 *data = g_malloc(blip->data_len + 14);
+					if (data) {
+						excel_fill_bmp_header(data, blip->data, blip->data_len);
+						memcpy(data + 14, blip->data, blip->data_len);
+						sheet_object_image_set_image (SHEET_OBJECT_IMAGE (so),
+							blip->type, data, blip->data_len + 14, FALSE);
+					}
+			        } else {
+					sheet_object_image_set_image (SHEET_OBJECT_IMAGE (so),
+						blip->type, blip->data, blip->data_len,
+						!blip->needs_free);
+					blip->needs_free = FALSE; /* image took over managing data */
+				}
 			}
 		} else if ((attr = ms_obj_attr_bag_lookup (obj->attrs,
 			MS_OBJ_ATTR_IMDATA)) != NULL) {



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