Reportbug seems to have ignored the patch, so I'm sending it again. -- "I'd rather listen to [Isaac] Newton than to [MicroSoft's] Mundie. He may have been dead for almost three hundred years, but despite that he stinks up the room less." --- (Linus Torvalds) Saludos /\/\ /\ >< `/
diff -ru src/gtkcairoplotitems.c /home/users/marga/sources/debian/packages/oregano-0.40.0/src/gtkcairoplotitems.c --- src/gtkcairoplotitems.c 2004-11-23 02:15:14.000000000 -0300 +++ /home/users/marga/sources/debian/packages/oregano-0.40.0/src/gtkcairoplotitems.c 2005-05-26 13:25:00.000000000 -0300 @@ -33,6 +33,7 @@ /* Fill cairo surface with transparent color */ static void cr_clear(cairo_t *cr, guint w, guint h) { + return; cairo_save (cr); cairo_set_operator (cr, CAIRO_OPERATOR_SRC); cairo_set_rgb_color (cr, 1, 1, 1); @@ -74,7 +75,7 @@ static void gtk_cairo_plot_item_draw_class_init (GtkCairoPlotItemDrawClass *class); static void gtk_cairo_plot_item_draw_init (GtkCairoPlotItemDraw *view); -static void gtk_cairo_plot_item_draw_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model); +static void gtk_cairo_plot_item_draw_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model, cairo_t *cr); static void gtk_cairo_plot_item_draw_get_point (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model, gdouble x, gdouble y, gdouble *x1, gdouble *y1); static GtkCairoPlotViewItem *draw_parent_class; @@ -187,10 +188,9 @@ * */ static void -gtk_cairo_plot_item_draw_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model) +gtk_cairo_plot_item_draw_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model, cairo_t *cr) { GtkCairoPlotItemDraw *draw; - cairo_t *cr; int i; guint points; Point *p; @@ -224,14 +224,6 @@ NULL); if (funcs == NULL) { - cr = cairo_create (); - cairo_set_target_surface (cr, surface); - - cairo_save (cr); - cairo_rectangle (cr, 0, 0, w, h); - cairo_fill (cr); - cairo_stroke (cr); - cairo_destroy (cr); return; } @@ -266,15 +258,8 @@ sy = 1.0; } - cr = cairo_create (); - cairo_set_target_surface (cr, surface); - cairo_save (cr); - cairo_rectangle (cr, 0, 0, w, h); - cairo_fill (cr); - cairo_stroke (cr); - /* Y Axis */ cairo_set_rgb_color (cr, 1, 0, 0); cairo_move_to (cr, X(0), Y(ymin)); @@ -429,7 +414,6 @@ } cairo_stroke (cr); cairo_restore (cr); /* Draw Lines */ - cairo_destroy(cr); } #undef X @@ -438,7 +422,7 @@ /* ========== Title Item ========== */ static void gtk_cairo_plot_item_title_class_init (GtkCairoPlotItemTitleClass *class); static void gtk_cairo_plot_item_title_init (GtkCairoPlotItemTitle *view); -static void gtk_cairo_plot_item_title_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model); +static void gtk_cairo_plot_item_title_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model, cairo_t *cr); static GtkCairoPlotViewItem *title_parent_class; @@ -490,9 +474,8 @@ } static void -gtk_cairo_plot_item_title_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model) +gtk_cairo_plot_item_title_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model, cairo_t *cr) { - cairo_t *cr; char *title; cairo_text_extents_t extend; cairo_surface_t *surface; @@ -500,9 +483,6 @@ g_object_get (G_OBJECT (item), "width", &w, "height", &h, "surface", &surface, NULL); - cr = cairo_create (); - cairo_set_target_surface (cr, surface); - cr_clear (cr, w, h); g_object_get (G_OBJECT (model), "title", &title, NULL); @@ -523,14 +503,13 @@ } cairo_stroke (cr); - cairo_destroy (cr); } /* ==== Rectangle ==== */ static void gtk_cairo_plot_item_rect_class_init (GtkCairoPlotItemRectClass *class); static void gtk_cairo_plot_item_rect_init (GtkCairoPlotItemRect *view); -static void gtk_cairo_plot_item_rect_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model); +static void gtk_cairo_plot_item_rect_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model, cairo_t *cr); static GtkCairoPlotViewItem *rect_parent_class; @@ -581,22 +560,16 @@ } static void -gtk_cairo_plot_item_rect_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model) +gtk_cairo_plot_item_rect_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model, cairo_t *cr) { cairo_surface_t *surface; guint w, h; - cairo_t *cr; g_object_get (G_OBJECT (item), "width", &w, "height", &h, "surface", &surface, NULL); /* Redimensionar (es decir, eliminar y volver a crear) la surface para * este item no es util. Hay que reveer como hacerlo de mejor manera */ - cr = cairo_create (); - cairo_set_target_surface (cr, surface); - - cr_clear (cr, w, h); - cairo_set_rgb_color (cr, 0, 0, 0); cairo_rectangle (cr, 0, 0, w, h); cairo_save (cr); @@ -604,9 +577,6 @@ cairo_set_rgb_color (cr, 0.2, 0.7, 0.2); cairo_fill (cr); cairo_restore (cr); - cairo_stroke (cr); - - cairo_destroy (cr); } diff -ru src/gtkcairoplotview.c /home/users/marga/sources/debian/packages/oregano-0.40.0/src/gtkcairoplotview.c --- src/gtkcairoplotview.c 2004-11-25 12:14:06.000000000 -0300 +++ /home/users/marga/sources/debian/packages/oregano-0.40.0/src/gtkcairoplotview.c 2005-05-26 13:25:00.000000000 -0300 @@ -251,19 +251,18 @@ g_return_if_fail (IS_GTK_CAIRO_PLOT_VIEW (view)); g_return_if_fail (IS_GTK_CAIRO_PLOT_MODEL (model)); - cairo_set_alpha (cr, 1.0); - cairo_set_rgb_color (cr, 255, 255, 255); - cairo_fill (cr); - cairo_stroke (cr); + cairo_save (cr); + cairo_set_rgb_color (cr, 1, 1, 1); + cairo_rectangle (cr, 0, 0, 500, 500); + cairo_fill (cr); + cairo_stroke (cr); + cairo_restore (cr); it = view->priv->items; while (it) { item = it->data; cairo_save (cr); - /* Update the widget TODO : add some image caching */ - gtk_cairo_plot_view_item_update (item, model); - g_object_get (G_OBJECT (item), "x", &x, "y", &y, "width", &w, "height", &h, "surface", &surface, NULL); @@ -271,11 +270,7 @@ if (item != view->priv->attached) cairo_translate (cr, x, y); - cairo_save (cr); - if (view->priv->scaled) - cairo_surface_set_filter (surface, CAIRO_FILTER_BILINEAR); - cairo_show_surface (cr, surface, w, h); - cairo_restore (cr); + gtk_cairo_plot_view_item_update (item, model, cr); cairo_restore (cr); /* Draw item in the window */ @@ -550,7 +545,7 @@ } void -gtk_cairo_plot_view_item_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model) +gtk_cairo_plot_view_item_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model, cairo_t *cr) { GtkCairoPlotViewItemClass *class; @@ -558,12 +553,12 @@ g_return_if_fail (IS_GTK_CAIRO_PLOT_VIEW_ITEM (item)); /* Item is up2date!, don't redraw it */ - if (!item->priv->need_update) return; + //if (!item->priv->need_update) return; /* this is buggy, fail with null exception pointer �?!! */ class = GTK_CAIRO_PLOT_VIEW_ITEM_CLASS (G_OBJECT_GET_CLASS (item)); if (class->update) - class->update (item, model); + class->update (item, model, cr); item->priv->need_update = TRUE; } diff -ru src/gtkcairoplotview.h /home/users/marga/sources/debian/packages/oregano-0.40.0/src/gtkcairoplotview.h --- src/gtkcairoplotview.h 2004-11-24 17:18:35.000000000 -0300 +++ /home/users/marga/sources/debian/packages/oregano-0.40.0/src/gtkcairoplotview.h 2005-05-26 13:25:00.000000000 -0300 @@ -31,6 +31,7 @@ #include <glib.h> #include <glib-object.h> #include <gtk/gtk.h> +#include <cairo/cairo.h> #include "gtkcairoplotmodel.h" #define GTK_CAIRO_PLOT_VIEW_TYPE (gtk_cairo_plot_view_get_type ()) @@ -104,14 +105,14 @@ struct _GtkCairoPlotViewItemClass { GObjectClass parent_class; - void (*update) (GtkCairoPlotViewItem *view, GtkCairoPlotModel *model); + void (*update) (GtkCairoPlotViewItem *view, GtkCairoPlotModel *model, cairo_t *cr); void (*get_point) (GtkCairoPlotViewItem *view, GtkCairoPlotModel *model, gdouble x, gdouble y, gdouble *x1, gdouble *y1); }; GType gtk_cairo_plot_view_item_get_type (void); GtkCairoPlotViewItem *gtk_cairo_plot_view_item_new (GType type, guint x, guint y, guint w, guint h); void gtk_cairo_plot_view_item_get_point (GtkCairoPlotViewItem *view, GtkCairoPlotModel *model, gdouble x, gdouble y, gdouble *x1, gdouble *y1); -void gtk_cairo_plot_view_item_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model); +void gtk_cairo_plot_view_item_update (GtkCairoPlotViewItem *item, GtkCairoPlotModel *model, cairo_t *cr); #endif