[dia] [embedded image] Copying was creating broken images for save
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] [embedded image] Copying was creating broken images for save
- Date: Sun, 20 Feb 2011 15:33:18 +0000 (UTC)
commit 2f543309d9a22df62c3d5df7d6915675dcb356f4
Author: Hans Breuer <hans breuer org>
Date: Sun Feb 20 15:43:35 2011 +0100
[embedded image] Copying was creating broken images for save
Copying an embedded image lost the pixbuf reference, which later
could not be stored anymore - bug was invisible during the life
cycle of the object in memory.
Unrelated: consider draw_border for bounding box calculation.
objects/standard/image.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/objects/standard/image.c b/objects/standard/image.c
index f43cb02..0be5b76 100644
--- a/objects/standard/image.c
+++ b/objects/standard/image.c
@@ -447,7 +447,7 @@ image_update_data(Image *image)
image->connections[8].pos.x = elem->corner.x + elem->width / 2.0;
image->connections[8].pos.y = elem->corner.y + elem->height / 2.0;
- extra->border_trans = image->border_width / 2.0;
+ extra->border_trans = (image->draw_border ? image->border_width / 2.0 : 0.0);
element_update_boundingbox(elem);
obj->position = elem->corner;
@@ -560,6 +560,16 @@ image_copy(Image *image)
dia_image_add_ref(image->image);
newimage->image = image->image;
+ /* not sure if we only want a reference, but it would be safe when
+ * someday editing doe not work inplace, but creates new pixbufs
+ * for every single undoable step */
+ newimage->inline_data = image->inline_data;
+ if (image->pixbuf)
+ newimage->pixbuf = g_object_ref(image->pixbuf);
+ else
+ newimage->pixbuf = image->pixbuf;
+
+ newimage->mtime = image->mtime;
newimage->draw_border = image->draw_border;
newimage->keep_aspect = image->keep_aspect;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]