[goffice] fixed a few issues with filled items.



commit 81402b4c7311f67f4ff8ac8f4dc151db690c5c64
Author: Jean Brefort <jean brefort normalesup org>
Date:   Wed Mar 3 13:55:38 2010 +0100

    fixed a few issues with filled items.

 ChangeLog                     |   15 +++++++++++++++
 goffice/canvas/goc-arc.c      |    6 +++---
 goffice/canvas/goc-item.c     |    3 ---
 goffice/canvas/goc-polygon.c  |    3 +++
 goffice/canvas/goc-polyline.c |    9 ++++++---
 5 files changed, 27 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 471d7c1..0a12d86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2010-03-03  Valek Filippov  <frob gnome org>
+
+	* goffice/canvas/goc-arc.c (goc_arc_update_bounds),
+	(goc_arc_distance): fixed for filled items.
+	* goffice/canvas/goc-polygon.c (goc_polygon_update_bounds),
+	(goc_polygon_distance): little optimization.
+	* goffice/canvas/goc-polyline.c (goc_polyline_update_bounds),
+	(goc_polyline_distance): ditto.
+
+2010-03-03  Jean Brefort  <jean brefort normalesup org>
+
+	* goffice/canvas/goc-polygon.c (goc_polygon_update_bounds): always
+	set bounds even if fully transparent.
+	* goffice/canvas/goc-polyline.c (goc_polyline_update_bounds): ditto.
+
 2010-03-02  Morten Welinder  <terra gnome org>
 
 	* goffice/gtk/go-locale-sel.c (go_locale_sel_get_locale): Plug
diff --git a/goffice/canvas/goc-arc.c b/goffice/canvas/goc-arc.c
index c5a36e2..319838b 100644
--- a/goffice/canvas/goc-arc.c
+++ b/goffice/canvas/goc-arc.c
@@ -260,7 +260,7 @@ goc_arc_update_bounds (GocItem *item)
 	cairo_surface_t *surface;
 	cairo_t *cr;
 
-	surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, goc_canvas_get_width(item->canvas),goc_canvas_get_height(item->canvas));
+	surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
 	cr = cairo_create (surface);
 
 	if (goc_arc_prepare_draw (item, cr, 0)) {
@@ -289,11 +289,11 @@ goc_arc_distance (GocItem *item, double x, double y, GocItem **near_item)
 	if (style->line.width < 5){
 		style->line.width = 5;
 	}
-	surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, goc_canvas_get_width(item->canvas),goc_canvas_get_height(item->canvas));
+	surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
 	cr = cairo_create (surface);
 
 	if (goc_arc_prepare_draw (item, cr, 0)){
-		if (arc->type > 0){
+		if (arc->type > 0 && style->fill.type != GO_STYLE_FILL_NONE){
 			if (cairo_in_fill (cr, x, y))
 				res = 0;
 		}
diff --git a/goffice/canvas/goc-item.c b/goffice/canvas/goc-item.c
index 9874a8e..18e2f81 100644
--- a/goffice/canvas/goc-item.c
+++ b/goffice/canvas/goc-item.c
@@ -274,9 +274,6 @@ _goc_item_update_bounds (GocItem *item)
 	GocItemClass *klass = GOC_ITEM_GET_CLASS (item);
 	g_return_if_fail (klass != NULL);
 
-/* removed because it breakd item-edit
-	 item->x0 = item->y0 = G_MAXDOUBLE;
-	item->x1 = item->y1 = -G_MAXDOUBLE;*/
 	if (klass->update_bounds)
 		klass->update_bounds (item);
 	item->cached_bounds = TRUE;
diff --git a/goffice/canvas/goc-polygon.c b/goffice/canvas/goc-polygon.c
index 306b7ee..e963a23 100644
--- a/goffice/canvas/goc-polygon.c
+++ b/goffice/canvas/goc-polygon.c
@@ -164,6 +164,9 @@ goc_polygon_update_bounds (GocItem *item)
 			cairo_stroke_extents (cr, &item->x0, &item->y0, &item->x1, &item->y1);
 		else
 			cairo_fill_extents (cr, &item->x0, &item->y0, &item->x1, &item->y1);
+	} else {
+		item->x0 = item->y0 = G_MAXDOUBLE;
+		item->x1 = item->y1 = -G_MAXDOUBLE;
 	}
 	cairo_destroy (cr);
 	cairo_surface_destroy (surface);
diff --git a/goffice/canvas/goc-polyline.c b/goffice/canvas/goc-polyline.c
index 29023cf..3787a13 100644
--- a/goffice/canvas/goc-polyline.c
+++ b/goffice/canvas/goc-polyline.c
@@ -146,11 +146,14 @@ goc_polyline_update_bounds (GocItem *item)
 	cairo_surface_t *surface;
 	cairo_t *cr;
 
-	surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, goc_canvas_get_width(item->canvas),goc_canvas_get_height(item->canvas));
+	surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
 	cr = cairo_create (surface);
 
 	if (goc_polyline_prepare_draw (item, cr, 0)) {
 		cairo_stroke_extents (cr, &item->x0, &item->y0, &item->x1, &item->y1);
+	} else {
+		item->x0 = item->y0 = G_MAXDOUBLE;
+		item->x1 = item->y1 = -G_MAXDOUBLE;
 	}
 
 	cairo_destroy (cr);
@@ -175,10 +178,10 @@ goc_polyline_distance (GocItem *item, double x, double y, GocItem **near_item)
 	if (style->line.width < 5) {
 		style->line.width = 5;
 	}
-	surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, goc_canvas_get_width (item->canvas), goc_canvas_get_height (item->canvas));
+	surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
 	cr = cairo_create (surface);
 
-	if (goc_polyline_prepare_draw (item,cr,0)) {
+	if (goc_polyline_prepare_draw (item, cr, 0)) {
 		if (cairo_in_stroke (cr, x, y))
 			res = 0;
 	}



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