[evolution/gtk3] No need to 'save_matrix' separately in cairo



commit e018e66b343f8fa781bfc519378af65ba2bd195d
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jan 26 12:01:12 2011 +0100

    No need to 'save_matrix' separately in cairo
    
    It's reverting my previous commit, where it seemed to help a bit.

 calendar/gui/e-day-view-main-item.c    |    4 ----
 calendar/gui/e-day-view-time-item.c    |    7 -------
 calendar/gui/e-meeting-time-sel-item.c |    3 ---
 calendar/gui/e-week-view-main-item.c   |    3 ---
 libgnomecanvas/gnome-canvas-pixbuf.c   |    4 +---
 widgets/misc/e-calendar-item.c         |    5 -----
 widgets/misc/e-map.c                   |    6 +++---
 widgets/table/e-cell-pixbuf.c          |    3 ---
 widgets/table/e-cell-tree.c            |    3 ---
 widgets/table/e-cell.c                 |    4 ----
 widgets/table/e-table-item.c           |    3 ---
 11 files changed, 4 insertions(+), 41 deletions(-)
---
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index e1885ee..726caff 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -527,8 +527,6 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
 			bar_y1 = item_y + 1;
 
 		else if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_BOTTOM_EDGE) {
-			cairo_matrix_t save_matrix;
-
 			bar_y2 = item_y + item_h - 1;
 
 			end_minute = event->end_minute;
@@ -541,7 +539,6 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
 							    &end_resize_suffix,
 							    &end_suffix_width);
 
-			cairo_get_matrix (cr, &save_matrix);
 			cairo_save (cr);
 			cairo_rectangle (cr, item_x + E_DAY_VIEW_BAR_WIDTH + 1.75, item_y + 2.75,
 				item_w - E_DAY_VIEW_BAR_WIDTH - 4.5,
@@ -569,7 +566,6 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
 			cairo_show_text (cr, end_regsizeime);
 			cairo_close_path (cr);
 			cairo_restore (cr);
-			cairo_set_matrix (cr, &save_matrix);
 		}
 	}
 
diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c
index 5066b5f..2340f25 100644
--- a/calendar/gui/e-day-view-time-item.c
+++ b/calendar/gui/e-day-view-time-item.c
@@ -303,7 +303,6 @@ edvti_draw_zone (GnomeCanvasItem   *canvas_item,
 	PangoFontMetrics *large_font_metrics, *small_font_metrics;
 	GdkColor fg, dark;
 	GdkColor mb_color;
-	cairo_matrix_t save_matrix;
 
 	time_item = E_DAY_VIEW_TIME_ITEM (canvas_item);
 	day_view = e_day_view_time_item_get_day_view (time_item);
@@ -495,7 +494,6 @@ edvti_draw_zone (GnomeCanvasItem   *canvas_item,
 					    display_hour, suffix);
 			}
 
-			cairo_get_matrix (cr, &save_matrix);
 			cairo_save (cr);
 			if (show_midnight_date)
 				gdk_cairo_set_source_color (cr, &mb_color);
@@ -508,7 +506,6 @@ edvti_draw_zone (GnomeCanvasItem   *canvas_item,
 			pango_cairo_update_layout (cr, layout);
 			pango_cairo_show_layout (cr, layout);
 			cairo_restore (cr);
-			cairo_set_matrix (cr, &save_matrix);
 
 			g_object_unref (layout);
 		} else {
@@ -533,7 +530,6 @@ edvti_draw_zone (GnomeCanvasItem   *canvas_item,
 				cairo_stroke (cr);
 				cairo_restore (cr);
 
-				cairo_get_matrix (cr, &save_matrix);
 				cairo_save (cr);
 				if (show_midnight_date)
 					gdk_cairo_set_source_color (cr, &mb_color);
@@ -547,7 +543,6 @@ edvti_draw_zone (GnomeCanvasItem   *canvas_item,
 				pango_cairo_update_layout (cr, layout);
 				pango_cairo_show_layout (cr, layout);
 				cairo_restore (cr);
-				cairo_set_matrix (cr, &save_matrix);
 
 				g_object_unref (layout);
 			} else {
@@ -578,7 +573,6 @@ edvti_draw_zone (GnomeCanvasItem   *canvas_item,
 						    "%02i", minute);
 				}
 
-				cairo_get_matrix (cr, &save_matrix);
 				cairo_save (cr);
 				if (show_midnight_date)
 					gdk_cairo_set_source_color (cr, &mb_color);
@@ -592,7 +586,6 @@ edvti_draw_zone (GnomeCanvasItem   *canvas_item,
 				pango_cairo_update_layout (cr, layout);
 				pango_cairo_show_layout (cr, layout);
 				cairo_restore (cr);
-				cairo_set_matrix (cr, &save_matrix);
 
 				g_object_unref (layout);
 			}
diff --git a/calendar/gui/e-meeting-time-sel-item.c b/calendar/gui/e-meeting-time-sel-item.c
index b36e075..0ac891c 100644
--- a/calendar/gui/e-meeting-time-sel-item.c
+++ b/calendar/gui/e-meeting-time-sel-item.c
@@ -205,9 +205,7 @@ draw_strikeout_box (EMeetingTimeSelectorItem *mts_item, cairo_t *cr,
 {
 	GnomeCanvas *canvas = GNOME_CANVAS_ITEM (mts_item)->canvas;
 	EMeetingTimeSelector *mts = mts_item->mts;
-	cairo_matrix_t save_matrix;
 
-	cairo_get_matrix (cr, &save_matrix);
 	cairo_save (cr);
 
 	cairo_rectangle (cr, x, y, width, height);
@@ -218,7 +216,6 @@ draw_strikeout_box (EMeetingTimeSelectorItem *mts_item, cairo_t *cr,
 	cairo_paint (cr);
 
 	cairo_restore (cr);
-	cairo_set_matrix (cr, &save_matrix);
 }
 
 static void
diff --git a/calendar/gui/e-week-view-main-item.c b/calendar/gui/e-week-view-main-item.c
index 7593dfc..ae4316c 100644
--- a/calendar/gui/e-week-view-main-item.c
+++ b/calendar/gui/e-week-view-main-item.c
@@ -88,7 +88,6 @@ week_view_main_item_draw_day (EWeekViewMainItem *main_item,
 	PangoLayout *layout;
 	gboolean today = FALSE;
 	CalWeekdays working_days;
-	cairo_matrix_t save_matrix;
 
 	week_view = e_week_view_main_item_get_week_view (main_item);
 	style = gtk_widget_get_style (GTK_WIDGET (week_view));
@@ -236,7 +235,6 @@ week_view_main_item_draw_day (EWeekViewMainItem *main_item,
 			format_string = _("%d %b");
 	}
 
-	cairo_get_matrix (cr, &save_matrix);
 	cairo_save (cr);
 	if (selected) {
 		gdk_cairo_set_source_color (
@@ -280,7 +278,6 @@ week_view_main_item_draw_day (EWeekViewMainItem *main_item,
 	pango_cairo_update_layout (cr, layout);
 	pango_cairo_show_layout (cr, layout);
 	cairo_restore (cr);
-	cairo_set_matrix (cr, &save_matrix);
 	g_object_unref (layout);
 
 	/* Draw the line under the date. */
diff --git a/libgnomecanvas/gnome-canvas-pixbuf.c b/libgnomecanvas/gnome-canvas-pixbuf.c
index afc6754..6fc3e44 100644
--- a/libgnomecanvas/gnome-canvas-pixbuf.c
+++ b/libgnomecanvas/gnome-canvas-pixbuf.c
@@ -269,7 +269,7 @@ gnome_canvas_pixbuf_draw (GnomeCanvasItem *item, cairo_t *cr,
 {
 	GnomeCanvasPixbuf *gcp;
 	GnomeCanvasPixbufPrivate *priv;
-        cairo_matrix_t matrix, save_matrix;
+        cairo_matrix_t matrix;
 
 	gcp = GNOME_CANVAS_PIXBUF (item);
 	priv = gcp->priv;
@@ -279,14 +279,12 @@ gnome_canvas_pixbuf_draw (GnomeCanvasItem *item, cairo_t *cr,
 
         gnome_canvas_item_i2c_matrix (item, &matrix);
 
-	cairo_get_matrix (cr, &save_matrix);
 	cairo_save (cr);
         cairo_transform (cr, &matrix);
 
         gdk_cairo_set_source_pixbuf (cr, priv->pixbuf, 0, 0);
         cairo_paint (cr);
 	cairo_restore (cr);
-	cairo_set_matrix (cr, &save_matrix);
 }
 
 
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index f849d3b..3376444 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -1395,7 +1395,6 @@ e_calendar_item_draw_day_numbers (ECalendarItem	*calitem,
 	PangoContext *pango_context;
 	PangoFontMetrics *font_metrics;
 	PangoLayout *layout;
-	cairo_matrix_t save_matrix;
 
 	item = GNOME_CANVAS_ITEM (calitem);
 	widget = GTK_WIDGET (item->canvas);
@@ -1501,7 +1500,6 @@ e_calendar_item_draw_day_numbers (ECalendarItem	*calitem,
 			text_x -= calitem->week_number_digit_widths[digit] + 6;
 			num_chars += sprintf (&buffer[num_chars], get_digit_fomat (), digit);
 
-			cairo_get_matrix (cr, &save_matrix);
 			cairo_save (cr);
 			gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_ACTIVE]);
 			pango_layout_set_font_description (layout, font_desc);
@@ -1510,7 +1508,6 @@ e_calendar_item_draw_day_numbers (ECalendarItem	*calitem,
 			pango_cairo_update_layout (cr, layout);
 			pango_cairo_show_layout (cr, layout);
 			cairo_restore (cr);
-			cairo_set_matrix (cr, &save_matrix);
 		}
 
 		for (dcol = 0; dcol < 7; dcol++) {
@@ -1621,7 +1618,6 @@ e_calendar_item_draw_day_numbers (ECalendarItem	*calitem,
 				day_x -= calitem->digit_widths[digit];
 				num_chars += sprintf (&buffer[num_chars], get_digit_fomat (), digit);
 
-				cairo_get_matrix (cr, &save_matrix);
 				cairo_save (cr);
 				if (fg_color) {
 					gdk_cairo_set_source_color (cr, fg_color);
@@ -1647,7 +1643,6 @@ e_calendar_item_draw_day_numbers (ECalendarItem	*calitem,
 				pango_cairo_update_layout (cr, layout);
 				pango_cairo_show_layout (cr, layout);
 				cairo_restore (cr);
-				cairo_set_matrix (cr, &save_matrix);
 			}
 
 			/* See if we've reached the end of a month. */
diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c
index c72b15e..f4c981b 100644
--- a/widgets/misc/e-map.c
+++ b/widgets/misc/e-map.c
@@ -634,14 +634,14 @@ static gboolean
 e_map_draw (GtkWidget *widget, cairo_t *cr)
 {
 	EMap *map;
-	cairo_matrix_t matrix, save_matrix;
+	cairo_matrix_t matrix;
 
 	if (!gtk_widget_is_drawable (widget))
 		return FALSE;
 
 	map = E_MAP (widget);
 
-	cairo_get_matrix (cr, &save_matrix);
+	cairo_save (cr);
 
 	e_map_tweens_compute_matrix (map, &matrix);
 	cairo_transform (cr, &matrix);
@@ -649,7 +649,7 @@ e_map_draw (GtkWidget *widget, cairo_t *cr)
 	cairo_set_source_surface (cr, map->priv->map_render_surface, 0, 0);
 	cairo_paint (cr);
 
-	cairo_set_matrix (cr, &save_matrix);
+	cairo_restore (cr);
 
 	return FALSE;
 }
diff --git a/widgets/table/e-cell-pixbuf.c b/widgets/table/e-cell-pixbuf.c
index ec70dd8..b634683 100644
--- a/widgets/table/e-cell-pixbuf.c
+++ b/widgets/table/e-cell-pixbuf.c
@@ -193,20 +193,17 @@ pixbuf_print (ECellView *ecell_view, GtkPrintContext *context,
 	GdkPixbuf *pixbuf;
 	gint scale;
 	cairo_t *cr = gtk_print_context_get_cairo_context (context);
-	cairo_matrix_t save_matrix;
 
 	pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, 1, row);
 	if (pixbuf == NULL)
 		return;
 
 	scale = gdk_pixbuf_get_height (pixbuf);
-	cairo_get_matrix (cr, &save_matrix);
 	cairo_save (cr);
 	cairo_translate (cr, 0, (gdouble)(height - scale) / (gdouble)2);
 	gdk_cairo_set_source_pixbuf (cr, pixbuf, (gdouble)scale, (gdouble)scale);
 	cairo_paint (cr);
 	cairo_restore (cr);
-	cairo_set_matrix (cr, &save_matrix);
 }
 
 static gdouble
diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c
index 51a764d..bdfc1cb 100644
--- a/widgets/table/e-cell-tree.c
+++ b/widgets/table/e-cell-tree.c
@@ -624,9 +624,7 @@ ect_print (ECellView *ecell_view, GtkPrintContext *context,
 {
 	ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
 	cairo_t *cr = gtk_print_context_get_cairo_context (context);
-	cairo_matrix_t save_matrix;
 
-	cairo_get_matrix (cr, &save_matrix);
 	cairo_save (cr);
 
 	if (/* XXX only if we're the active sort */ TRUE) {
@@ -694,7 +692,6 @@ ect_print (ECellView *ecell_view, GtkPrintContext *context,
 	}
 
 	cairo_restore (cr);
-	cairo_set_matrix (cr, &save_matrix);
 
 	e_cell_print (tree_view->subcell_view, context, model_col, view_col, row, width, height);
 }
diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c
index 67d2e1c..b479e0c 100644
--- a/widgets/table/e-cell.c
+++ b/widgets/table/e-cell.c
@@ -261,19 +261,15 @@ e_cell_draw (ECellView *ecell_view, cairo_t *cr,
 	     gint model_col, gint view_col, gint row, ECellFlags flags,
 	     gint x1, gint y1, gint x2, gint y2)
 {
-	cairo_matrix_t save_matrix;
-
 	g_return_if_fail (ecell_view != NULL);
 	g_return_if_fail (row >= 0);
 	g_return_if_fail (row < e_table_model_row_count (ecell_view->e_table_model));
 
-	cairo_get_matrix (cr, &save_matrix);
 	cairo_save (cr);
 
 	ECVIEW_EC_CLASS (ecell_view)->draw (ecell_view, cr, model_col, view_col, row, flags, x1, y1, x2, y2);
 
 	cairo_restore (cr);
-	cairo_set_matrix (cr, &save_matrix);
 }
 
 /**
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 45b9389..a66d57d 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -3417,9 +3417,7 @@ e_table_item_print_page  (EPrintable *ep,
 
 		for (col = 0; col < cols; col++) {
 			ECellView *ecell_view = eti->cell_views[col];
-			cairo_matrix_t save_matrix;
 
-			cairo_get_matrix (cr, &save_matrix);
 			cairo_save (cr);
 			cairo_translate (cr, xd, yd);
 			cairo_rectangle (cr, 0, 0, widths[col] - 1, row_height);
@@ -3433,7 +3431,6 @@ e_table_item_print_page  (EPrintable *ep,
 				      row_height + 2 );
 
 			cairo_restore (cr);
-			cairo_set_matrix (cr, &save_matrix);
 
 			xd += widths[col];
 		}



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