[gnumeric] Fixed image bounds in zoomed sheets.



commit b4922cd0b556e74fdeb3873d23387285859c4b25
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sun Nov 7 12:14:06 2010 +0100

    Fixed image bounds in zoomed sheets.

 ChangeLog                |    5 +++++
 NEWS                     |    1 +
 src/sheet-object-image.c |   10 ++++++----
 3 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7066853..5bbb0c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-07  Jean Brefort  <jean brefort normalesup org>
+
+	* src/sheet-object-image.c (so_image_view_set_bounds): fixed image bounds
+	in zoomed sheets.
+
 2010-11-06  Jean Brefort  <jean brefort normalesup org>
 
 	* src/dead-kittens.h: fixed property name in gtk_table_get_size(). [#634149]
diff --git a/NEWS b/NEWS
index 696fe43..52a4ff0 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,7 @@ Jean:
 	* Fixed maximum for col/row number in sheet resize dialog. [#631702]
 	* Eliminate glade usage.  [#631717]
 	* Fixed crash in print setup. [#634149]
+	* Fixed image bounds in zoomed sheets.
 
 Morten:
 	* Fix crash related to broken xls.  [#632050]
diff --git a/src/sheet-object-image.c b/src/sheet-object-image.c
index 5797bd5..2e6de2b 100644
--- a/src/sheet-object-image.c
+++ b/src/sheet-object-image.c
@@ -47,15 +47,17 @@ static void
 so_image_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean visible)
 {
 	GocItem *view = GOC_ITEM (GOC_GROUP (sov)->children->data);
+	double scale = goc_canvas_get_pixels_per_unit (view->canvas);
+
 	if (visible) {
 		double x, y, width, height;
 		double old_x1, old_y1, old_x2, old_y2, old_width, old_height;
 		GdkPixbuf *placeholder = g_object_get_data (G_OBJECT (view), "tile");
 
-		x = MIN (coords [0], coords [2]);
-		y = MIN (coords [1], coords [3]);
-		width  = fabs (coords [2] - coords [0]);
-		height = fabs (coords [3] - coords [1]);
+		x = MIN (coords [0], coords [2]) / scale;
+		y = MIN (coords [1], coords [3]) / scale;
+		width  = fabs (coords [2] - coords [0]) / scale;
+		height = fabs (coords [3] - coords [1]) / scale;
 
 		goc_item_get_bounds (view, &old_x1, &old_y1, &old_x2, &old_y2);
 		goc_item_set (view,



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