[evolution/gtk3] Use cairo_t for GnomeCanvasItem's draw methods
- From: Vibha Yadav <yvibha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gtk3] Use cairo_t for GnomeCanvasItem's draw methods
- Date: Mon, 13 Dec 2010 11:59:28 +0000 (UTC)
commit 01a20dd906a15802df61cdbcfb02b1f8675930f1
Author: Vibha Yadav <yvibha novell com>
Date: Mon Dec 13 17:25:27 2010 +0530
Use cairo_t for GnomeCanvasItem's draw methods
Adapting changes in draw api call for gtk+-3.0.
As GdkDrawable is now deprecated
http://git.gnome.org/browse/gtk+/commit/?id=218eea43785809ce43e894ed1bd94e18757f4efa
calendar/gui/e-day-view-main-item.c | 45 +++++++++----------------------
calendar/gui/e-day-view-time-item.c | 14 +++------
calendar/gui/e-day-view-top-item.c | 27 ++++---------------
calendar/gui/e-meeting-time-sel-item.c | 33 ++++++++---------------
calendar/gui/e-week-view-event-item.c | 27 +++++--------------
calendar/gui/e-week-view-main-item.c | 9 ++----
calendar/gui/e-week-view-titles-item.c | 5 +---
libgnomecanvas/gnome-canvas-rect.c | 2 +-
widgets/table/e-table-header-utils.c | 2 -
widgets/table/e-table-item.c | 18 ++++--------
10 files changed, 54 insertions(+), 128 deletions(-)
---
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index 241c5dd..8a9de41 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -90,7 +90,7 @@ icalcomp_is_transparent (icalcomponent *icalcomp)
static void
day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *main_item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x,
gint y,
gint width,
@@ -102,7 +102,6 @@ day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *main_item,
ECalendarView *cal_view;
gint time_divisions;
gint event_num, start_day, end_day, day, bar_y1, bar_y2, grid_x;
- cairo_t *cr = NULL;
GdkColor bg_color;
day_view = e_day_view_main_item_get_day_view (main_item);
@@ -150,11 +149,8 @@ day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *main_item,
}
if (bar_y1 < height && bar_y2 > 0 && bar_y2 > bar_y1 && can_draw_in_region (draw_region, grid_x, bar_y1, E_DAY_VIEW_BAR_WIDTH - 2, bar_y2 - bar_y1)) {
- if (!cr) {
- cr = gdk_cairo_create (drawable);
- cairo_save (cr);
- gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND]);
- }
+ cairo_save (cr);
+ gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND]);
if (first) {
first = FALSE;
@@ -172,13 +168,12 @@ day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *main_item,
if (cr) {
cairo_restore (cr);
- cairo_destroy (cr);
}
}
static void
day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x,
gint y,
gint width,
@@ -200,7 +195,6 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
gboolean draw_reminder_icon, draw_recurrence_icon, draw_timezone_icon, draw_meeting_icon;
gboolean draw_attach_icon;
ECalComponentTransparency transparency;
- cairo_t *cr;
cairo_pattern_t *pat;
cairo_font_options_t *font_options;
guint16 red, green, blue;
@@ -244,14 +238,12 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
if (!can_draw_in_region (draw_region, item_x, item_y, item_w, item_h))
return;
- cr = gdk_cairo_create (drawable);
gdk_cairo_set_source_color (cr,
&day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR]);
font_options = get_font_options ();
if (!is_array_index_in_bounds (day_view->events[day], event_num)) {
- cairo_destroy (cr);
return;
}
@@ -259,7 +251,6 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
event_num);
if (!is_comp_data_valid (event)) {
- cairo_destroy (cr);
return;
}
@@ -817,12 +808,11 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
g_free (text);
g_object_unref (comp);
- cairo_destroy (cr);
}
static void
day_view_main_item_draw_day_events (EDayViewMainItem *main_item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x,
gint y,
gint width,
@@ -838,14 +828,14 @@ day_view_main_item_draw_day_events (EDayViewMainItem *main_item,
for (event_num = 0; event_num < day_view->events[day]->len;
event_num++) {
day_view_main_item_draw_day_event (
- main_item, drawable, x, y, width, height,
+ main_item, cr, x, y, width, height,
day, event_num, draw_region);
}
}
static void
day_view_main_item_draw_events_in_vbars (EDayViewMainItem *main_item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x,
gint y,
gint width,
@@ -858,7 +848,6 @@ day_view_main_item_draw_events_in_vbars (EDayViewMainItem *main_item,
ECalendarView *cal_view;
gint time_divisions;
gint grid_x, event_num, bar_y, bar_h;
- cairo_t *cr = NULL;
GdkColor bg_color;
day_view = e_day_view_main_item_get_day_view (main_item);
@@ -895,12 +884,9 @@ day_view_main_item_draw_events_in_vbars (EDayViewMainItem *main_item,
continue;
}
- if (!cr) {
- cr = gdk_cairo_create (drawable);
- cairo_save (cr);
+ cairo_save (cr);
- gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND]);
- }
+ gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND]);
if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)), event->comp_data), &bg_color)) {
gdk_cairo_set_source_color (cr, &bg_color);
@@ -913,7 +899,6 @@ day_view_main_item_draw_events_in_vbars (EDayViewMainItem *main_item,
if (cr) {
cairo_restore (cr);
- cairo_destroy (cr);
}
}
@@ -987,7 +972,7 @@ day_view_main_item_update (GnomeCanvasItem *item,
static void
day_view_main_item_draw (GnomeCanvasItem *canvas_item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x,
gint y,
gint width,
@@ -1009,13 +994,10 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item,
gint start_row, end_row, rect_x, rect_y, rect_width, rect_height;
struct icaltimetype day_start_tt, today_tt;
gint weekday;
- cairo_t *cr;
gboolean today = FALSE;
GdkRegion *draw_region;
GdkRectangle rect;
- cr = gdk_cairo_create (drawable);
-
main_item = E_DAY_VIEW_MAIN_ITEM (canvas_item);
day_view = e_day_view_main_item_get_day_view (main_item);
g_return_if_fail (day_view != NULL);
@@ -1183,20 +1165,20 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item,
/* Fill in the bars when the user is busy. */
day_view_main_item_draw_events_in_vbars (
- main_item, drawable, x, y,
+ main_item, cr, x, y,
width, height, day, draw_region);
}
/* Fill in the vertical bars corresponding to the busy times from the
long events. */
day_view_main_item_draw_long_events_in_vbars (
- main_item, drawable, x, y, width, height, draw_region);
+ main_item, cr, x, y, width, height, draw_region);
/* Draw the event borders and backgrounds, and the vertical bars
down the left edges. */
for (day = 0; day < day_view->days_shown; day++)
day_view_main_item_draw_day_events (
- main_item, drawable, x, y,
+ main_item, cr, x, y,
width, height, day, draw_region);
if (e_day_view_marcus_bains_get_show_line (day_view)) {
@@ -1233,7 +1215,6 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item,
}
cairo_restore (cr);
}
- cairo_destroy (cr);
gdk_region_destroy (draw_region);
}
diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c
index 19f776e..2340f25 100644
--- a/calendar/gui/e-day-view-time-item.c
+++ b/calendar/gui/e-day-view-time-item.c
@@ -77,7 +77,7 @@ static void e_day_view_time_item_update (GnomeCanvasItem *item,
const cairo_matrix_t *i2c,
gint flags);
static void e_day_view_time_item_draw (GnomeCanvasItem *item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x, gint y,
gint width, gint height);
static GnomeCanvasItem *e_day_view_time_item_point (GnomeCanvasItem *item,
@@ -275,7 +275,7 @@ e_day_view_time_item_update (GnomeCanvasItem *item,
*/
static void
edvti_draw_zone (GnomeCanvasItem *canvas_item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x,
gint y,
gint width,
@@ -301,12 +301,9 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item,
PangoContext *context;
PangoFontDescription *small_font_desc;
PangoFontMetrics *large_font_metrics, *small_font_metrics;
- cairo_t *cr;
GdkColor fg, dark;
GdkColor mb_color;
- cr = gdk_cairo_create (drawable);
-
time_item = E_DAY_VIEW_TIME_ITEM (canvas_item);
day_view = e_day_view_time_item_get_day_view (time_item);
g_return_if_fail (day_view != NULL);
@@ -600,7 +597,6 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item,
pango_font_metrics_unref (large_font_metrics);
pango_font_metrics_unref (small_font_metrics);
- cairo_destroy (cr);
g_free (midnight_day);
g_free (midnight_month);
@@ -608,7 +604,7 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item,
static void
e_day_view_time_item_draw (GnomeCanvasItem *canvas_item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x,
gint y,
gint width,
@@ -619,10 +615,10 @@ e_day_view_time_item_draw (GnomeCanvasItem *canvas_item,
time_item = E_DAY_VIEW_TIME_ITEM (canvas_item);
g_return_if_fail (time_item != NULL);
- edvti_draw_zone (canvas_item, drawable, x, y, width, height, 0, NULL);
+ edvti_draw_zone (canvas_item, cr, x, y, width, height, 0, NULL);
if (time_item->priv->second_zone)
- edvti_draw_zone (canvas_item, drawable, x, y, width, height, time_item->priv->column_width, time_item->priv->second_zone);
+ edvti_draw_zone (canvas_item, cr, x, y, width, height, time_item->priv->column_width, time_item->priv->second_zone);
}
/* Increment the time by the 5/10/15/30/60 minute interval.
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index 9fb81b2..def481e 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -61,7 +61,7 @@ static gpointer parent_class;
the days visible on screen. */
static void
day_view_top_item_draw_triangle (EDayViewTopItem *top_item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x,
gint y,
gint w,
@@ -73,7 +73,6 @@ day_view_top_item_draw_triangle (EDayViewTopItem *top_item,
GdkColor bg_color;
GdkPoint points[3];
gint c1, c2;
- cairo_t *cr;
day_view = e_day_view_top_item_get_day_view (top_item);
@@ -99,8 +98,6 @@ day_view_top_item_draw_triangle (EDayViewTopItem *top_item,
if (!is_comp_data_valid (event))
return;
- cr = gdk_cairo_create (drawable);
-
cairo_save (cr);
/* Fill it in. */
if (gdk_color_parse (
@@ -130,15 +127,13 @@ day_view_top_item_draw_triangle (EDayViewTopItem *top_item,
cairo_line_to (cr, x + w, c2);
cairo_stroke (cr);
cairo_restore (cr);
-
- cairo_destroy (cr);
}
/* This draws one event in the top canvas. */
static void
day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
gint event_num,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x,
gint y,
gint width,
@@ -160,7 +155,6 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
GSList *categories_list, *elem;
PangoLayout *layout;
GdkColor bg_color;
- cairo_t *cr;
cairo_pattern_t *pat;
guint16 red, green, blue;
gdouble cc = 65535.0;
@@ -190,8 +184,6 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
if (!is_comp_data_valid (event))
return;
- cr = gdk_cairo_create (drawable);
-
style = gtk_widget_get_style (GTK_WIDGET (day_view));
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (
@@ -286,7 +278,7 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
if (draw_start_triangle
&& event->start < day_view->day_starts[start_day]) {
day_view_top_item_draw_triangle (
- top_item, drawable, item_x - x + 4, item_y - y,
+ top_item, cr, item_x - x + 4, item_y - y,
-E_DAY_VIEW_BAR_WIDTH, item_h, event_num);
}
@@ -294,7 +286,7 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
if (draw_end_triangle
&& event->end > day_view->day_starts[end_day + 1]) {
day_view_top_item_draw_triangle (
- top_item, drawable, item_x + item_w - 4 - x,
+ top_item, cr, item_x + item_w - 4 - x,
item_y - y, E_DAY_VIEW_BAR_WIDTH, item_h,
event_num);
}
@@ -304,7 +296,6 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
if (day_view->editing_event_day == E_DAY_VIEW_LONG_EVENT
&& day_view->editing_event_num == event_num) {
g_object_unref (comp);
- cairo_destroy (cr);
return;
}
@@ -479,7 +470,6 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
e_cal_component_free_categories_list (categories_list);
g_object_unref (comp);
- cairo_destroy (cr);
}
static void
@@ -564,7 +554,7 @@ day_view_top_item_update (GnomeCanvasItem *item,
static void
day_view_top_item_draw (GnomeCanvasItem *canvas_item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x,
gint y,
gint width,
@@ -579,7 +569,6 @@ day_view_top_item_draw (GnomeCanvasItem *canvas_item,
gint canvas_width, canvas_height, left_edge, day, date_width, date_x;
gint item_height, event_num;
PangoLayout *layout;
- cairo_t *cr;
GdkColor bg, light, dark;
gboolean show_dates;
@@ -588,8 +577,6 @@ day_view_top_item_draw (GnomeCanvasItem *canvas_item,
g_return_if_fail (day_view != NULL);
show_dates = top_item->priv->show_dates;
- cr = gdk_cairo_create (drawable);
-
style = gtk_widget_get_style (GTK_WIDGET (day_view));
gtk_widget_get_allocation (
GTK_WIDGET (canvas_item->canvas), &allocation);
@@ -742,12 +729,10 @@ day_view_top_item_draw (GnomeCanvasItem *canvas_item,
/* Draw the long events. */
for (event_num = 0; event_num < day_view->long_events->len; event_num++) {
day_view_top_item_draw_long_event (
- top_item, event_num, drawable,
+ top_item, event_num, cr,
x, y, width, height);
}
}
-
- cairo_destroy (cr);
}
static GnomeCanvasItem *
diff --git a/calendar/gui/e-meeting-time-sel-item.c b/calendar/gui/e-meeting-time-sel-item.c
index 7a50f13..156a083 100644
--- a/calendar/gui/e-meeting-time-sel-item.c
+++ b/calendar/gui/e-meeting-time-sel-item.c
@@ -49,7 +49,7 @@ static void e_meeting_time_selector_item_update (GnomeCanvasItem *item,
const cairo_matrix_t *i2c,
gint flags);
static void e_meeting_time_selector_item_draw (GnomeCanvasItem *item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x, gint y,
gint width, gint height);
static GnomeCanvasItem *e_meeting_time_selector_item_point (GnomeCanvasItem *item,
@@ -69,15 +69,15 @@ static void e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem
GDate *date,
gint x, gint scroll_y,
gint width, gint height);
-static void e_meeting_time_selector_item_paint_all_attendees_busy_periods (EMeetingTimeSelectorItem *mts_item, GdkDrawable *drawable, GDate *date, gint x, gint y, gint width, gint height);
+static void e_meeting_time_selector_item_paint_all_attendees_busy_periods (EMeetingTimeSelectorItem *mts_item, cairo_t *cr, GDate *date, gint x, gint y, gint width, gint height);
static void e_meeting_time_selector_item_paint_day (EMeetingTimeSelectorItem *mts_item,
cairo_t *cr,
GDate *date,
gint x, gint scroll_y,
gint width, gint height);
-static void e_meeting_time_selector_item_paint_busy_periods (EMeetingTimeSelectorItem *mts_item, GdkDrawable *drawable, GDate *date, gint x, gint scroll_y, gint width, gint height);
+static void e_meeting_time_selector_item_paint_busy_periods (EMeetingTimeSelectorItem *mts_item, cairo_t *cr, GDate *date, gint x, gint scroll_y, gint width, gint height);
static gint e_meeting_time_selector_item_find_first_busy_period (EMeetingTimeSelectorItem *mts_item, GDate *date, gint row);
-static void e_meeting_time_selector_item_paint_attendee_busy_periods (EMeetingTimeSelectorItem *mts_item, GdkDrawable *drawable, gint row, gint x, gint y, gint width, gint first_period, EMeetingFreeBusyType busy_type, cairo_t *cr);
+static void e_meeting_time_selector_item_paint_attendee_busy_periods (EMeetingTimeSelectorItem *mts_item, cairo_t *cr, gint row, gint x, gint y, gint width, gint first_period, EMeetingFreeBusyType busy_type);
static EMeetingTimeSelectorPosition e_meeting_time_selector_item_get_drag_position (EMeetingTimeSelectorItem *mts_item, gint x, gint y);
static gboolean e_meeting_time_selector_item_calculate_busy_range (EMeetingTimeSelector *mts,
@@ -219,7 +219,7 @@ draw_strikeout_box (EMeetingTimeSelectorItem *mts_item, cairo_t *cr,
}
static void
-e_meeting_time_selector_item_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint width, gint height)
+e_meeting_time_selector_item_draw (GnomeCanvasItem *item, cairo_t *cr, gint x, gint y, gint width, gint height)
{
EMeetingTimeSelector *mts;
EMeetingTimeSelectorItem *mts_item;
@@ -228,12 +228,10 @@ e_meeting_time_selector_item_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
gint row, row_y, start_x, end_x;
GDate date, last_date, current_date;
gboolean is_display_top, show_meeting_time;
- cairo_t *cr;
mts_item = E_MEETING_TIME_SELECTOR_ITEM (item);
mts = mts_item->mts;
g_return_if_fail (mts != NULL);
- cr = gdk_cairo_create (drawable);
is_display_top = (GTK_WIDGET (item->canvas) == mts->display_top)
? TRUE : FALSE;
@@ -334,9 +332,9 @@ e_meeting_time_selector_item_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
/* Draw the busy periods. */
if (is_display_top)
- e_meeting_time_selector_item_paint_all_attendees_busy_periods (mts_item, drawable, &date, x, y, width, height);
+ e_meeting_time_selector_item_paint_all_attendees_busy_periods (mts_item, cr, &date, x, y, width, height);
else
- e_meeting_time_selector_item_paint_busy_periods (mts_item, drawable, &date, x, y, width, height);
+ e_meeting_time_selector_item_paint_busy_periods (mts_item, cr, &date, x, y, width, height);
/* Draw the currently-selected meeting time vertical bars. */
if (show_meeting_time) {
@@ -367,7 +365,6 @@ e_meeting_time_selector_item_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
}
cairo_restore (cr);
}
- cairo_destroy (cr);
}
static void
@@ -479,16 +476,14 @@ e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem *mts_item,
list of attendees. For now we just paint the bars for each attendee of
each other. If we want to speed it up we could optimise it later. */
static void
-e_meeting_time_selector_item_paint_all_attendees_busy_periods (EMeetingTimeSelectorItem *mts_item, GdkDrawable *drawable, GDate *date, gint x, gint scroll_y, gint width, gint height)
+e_meeting_time_selector_item_paint_all_attendees_busy_periods (EMeetingTimeSelectorItem *mts_item, cairo_t *cr, GDate *date, gint x, gint scroll_y, gint width, gint height)
{
EMeetingTimeSelector *mts;
EMeetingFreeBusyType busy_type;
gint row, y;
gint *first_periods;
- cairo_t *cr;
mts = mts_item->mts;
- cr = gdk_cairo_create (drawable);
/* Calculate the y coordinate to paint the row at in the drawable. */
y = 2 * mts->row_height - scroll_y - 1;
@@ -505,12 +500,11 @@ e_meeting_time_selector_item_paint_all_attendees_busy_periods (EMeetingTimeSelec
for (row = 0; row < e_meeting_store_count_actual_attendees (mts->model); row++) {
if (first_periods[row] == -1)
continue;
- e_meeting_time_selector_item_paint_attendee_busy_periods (mts_item, drawable, x, y, width, row, first_periods[row], busy_type, cr);
+ e_meeting_time_selector_item_paint_attendee_busy_periods (mts_item, cr, x, y, width, row, first_periods[row], busy_type);
}
}
g_free (first_periods);
- cairo_destroy (cr);
}
static void
@@ -593,15 +587,13 @@ e_meeting_time_selector_item_paint_day (EMeetingTimeSelectorItem *mts_item,
/* This paints the colored bars representing busy periods for the individual
attendees. */
static void
-e_meeting_time_selector_item_paint_busy_periods (EMeetingTimeSelectorItem *mts_item, GdkDrawable *drawable, GDate *date, gint x, gint scroll_y, gint width, gint height)
+e_meeting_time_selector_item_paint_busy_periods (EMeetingTimeSelectorItem *mts_item, cairo_t *cr, GDate *date, gint x, gint scroll_y, gint width, gint height)
{
EMeetingTimeSelector *mts;
EMeetingFreeBusyType busy_type;
gint row, y, first_period;
- cairo_t *cr;
mts = mts_item->mts;
- cr = gdk_cairo_create (drawable);
/* Calculate the first visible attendee row. */
row = scroll_y / mts->row_height;
@@ -622,13 +614,12 @@ e_meeting_time_selector_item_paint_busy_periods (EMeetingTimeSelectorItem *mts_i
busy_type < E_MEETING_FREE_BUSY_LAST;
busy_type++) {
gdk_cairo_set_source_color (cr, &mts->busy_colors[busy_type]);
- e_meeting_time_selector_item_paint_attendee_busy_periods (mts_item, drawable, x, y, width, row, first_period, busy_type, cr);
+ e_meeting_time_selector_item_paint_attendee_busy_periods (mts_item, cr, x, y, width, row, first_period, busy_type);
}
}
y += mts->row_height;
row++;
}
- cairo_destroy (cr);
}
/* This subtracts the attendees longest_period_in_days from the given date,
@@ -666,7 +657,7 @@ e_meeting_time_selector_item_find_first_busy_period (EMeetingTimeSelectorItem *m
busy type, e.g out of office. It is passed the index of the first visible
busy period of the attendee and continues until it runs off the screen. */
static void
-e_meeting_time_selector_item_paint_attendee_busy_periods (EMeetingTimeSelectorItem *mts_item, GdkDrawable *drawable, gint x, gint y, gint width, gint row, gint first_period, EMeetingFreeBusyType busy_type, cairo_t *cr)
+e_meeting_time_selector_item_paint_attendee_busy_periods (EMeetingTimeSelectorItem *mts_item, cairo_t *cr, gint x, gint y, gint width, gint row, gint first_period, EMeetingFreeBusyType busy_type)
{
EMeetingTimeSelector *mts;
EMeetingAttendee *ia;
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index 7bf65b6..c06c97c 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -390,7 +390,7 @@ week_view_draw_time (EWeekView *week_view,
static void
week_view_event_item_draw_icons (EWeekViewEventItem *event_item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint icon_x,
gint icon_y,
gint x2,
@@ -407,7 +407,6 @@ week_view_event_item_draw_icons (EWeekViewEventItem *event_item,
gboolean draw_timezone_icon = FALSE, draw_attach_icon = FALSE;
gboolean draw_meeting_icon = FALSE;
GSList *categories_pixbufs = NULL, *pixbufs;
- cairo_t *cr;
canvas = GNOME_CANVAS_ITEM (event_item)->canvas;
parent = gtk_widget_get_parent (GTK_WIDGET (canvas));
@@ -426,8 +425,6 @@ week_view_event_item_draw_icons (EWeekViewEventItem *event_item,
e_cal_component_set_icalcomponent (
comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- cr = gdk_cairo_create (drawable);
-
if (e_cal_component_has_alarms (comp)) {
draw_reminder_icon = TRUE;
num_icons++;
@@ -505,7 +502,6 @@ week_view_event_item_draw_icons (EWeekViewEventItem *event_item,
g_slist_foreach (categories_pixbufs, (GFunc)g_object_unref, NULL);
g_slist_free (categories_pixbufs);
- cairo_destroy (cr);
g_object_unref (comp);
}
@@ -513,7 +509,7 @@ week_view_event_item_draw_icons (EWeekViewEventItem *event_item,
the days visible on screen. */
static void
week_view_event_item_draw_triangle (EWeekViewEventItem *event_item,
- GdkDrawable *drawable,
+ cairo_t *cr,
GdkColor bg_color,
gint x,
gint y,
@@ -529,7 +525,6 @@ week_view_event_item_draw_triangle (EWeekViewEventItem *event_item,
GdkPoint points[3];
const gchar *color_spec;
gint c1, c2;
- cairo_t *cr;
if (!can_draw_in_region (draw_region, x, y, w, h))
return;
@@ -547,8 +542,6 @@ week_view_event_item_draw_triangle (EWeekViewEventItem *event_item,
if (!is_comp_data_valid (event))
return;
- cr = gdk_cairo_create (drawable);
-
points[0].x = x;
points[0].y = y;
points[1].x = x + w;
@@ -597,8 +590,6 @@ week_view_event_item_draw_triangle (EWeekViewEventItem *event_item,
cairo_move_to (cr, x, y + h - 1);
cairo_line_to (cr, x + w, c2);
cairo_restore (cr);
-
- cairo_destroy (cr);
}
static void
@@ -693,7 +684,7 @@ week_view_event_item_update (GnomeCanvasItem *item,
static void
week_view_event_item_draw (GnomeCanvasItem *canvas_item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x,
gint y,
gint width,
@@ -713,7 +704,6 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item,
gboolean draw_start, draw_end;
gboolean draw_start_triangle = FALSE, draw_end_triangle = FALSE;
GdkColor bg_color;
- cairo_t *cr;
cairo_pattern_t *pat;
guint16 red, green, blue;
gdouble radius, cx0, cy0, rect_height, rect_width;
@@ -774,8 +764,6 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item,
return;
}
- cr = gdk_cairo_create (drawable);
-
icon_y = y1 + E_WEEK_VIEW_EVENT_BORDER_HEIGHT + E_WEEK_VIEW_ICON_Y_PAD;
/* Get the start & end times in 24-hour format. */
@@ -900,7 +888,7 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item,
/* Draw the icons. */
week_view_event_item_draw_icons (
- event_item, drawable, icon_x,
+ event_item, cr, icon_x,
icon_y, x2, FALSE, draw_region);
} else {
@@ -969,7 +957,7 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item,
if (draw_start_triangle) {
week_view_event_item_draw_triangle (
- event_item, drawable, bg_color,
+ event_item, cr, bg_color,
x1 + E_WEEK_VIEW_EVENT_L_PAD + 2,
y1, -3, y2 - y1 + 1, draw_region);
} else if (can_draw_in_region (draw_region, rect_x, y1, 1, y2 - y1)) {
@@ -990,7 +978,7 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item,
if (draw_end_triangle) {
week_view_event_item_draw_triangle (
- event_item, drawable, bg_color,
+ event_item, cr, bg_color,
x2 - E_WEEK_VIEW_EVENT_R_PAD - 2,
y1, 3, y2 - y1 + 1, draw_region);
} else if (can_draw_in_region (draw_region, rect_x2, y2, 1, 1)) {
@@ -1080,11 +1068,10 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item,
|| week_view->editing_span_num != event_item->priv->span_num)) {
icon_x = span->text_item->x1 - E_WEEK_VIEW_ICON_R_PAD - x;
week_view_event_item_draw_icons (
- event_item, drawable, icon_x,
+ event_item, cr, icon_x,
icon_y, max_icon_x, TRUE, draw_region);
}
}
- cairo_destroy (cr);
gdk_region_destroy (draw_region);
}
diff --git a/calendar/gui/e-week-view-main-item.c b/calendar/gui/e-week-view-main-item.c
index 252aa3c..ae4316c 100644
--- a/calendar/gui/e-week-view-main-item.c
+++ b/calendar/gui/e-week-view-main-item.c
@@ -69,7 +69,7 @@ static void
week_view_main_item_draw_day (EWeekViewMainItem *main_item,
gint day,
GDate *date,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x,
gint y,
gint width,
@@ -87,12 +87,10 @@ week_view_main_item_draw_day (EWeekViewMainItem *main_item,
PangoFontMetrics *font_metrics;
PangoLayout *layout;
gboolean today = FALSE;
- cairo_t *cr;
CalWeekdays working_days;
week_view = e_week_view_main_item_get_week_view (main_item);
style = gtk_widget_get_style (GTK_WIDGET (week_view));
- cr = gdk_cairo_create (drawable);
/* Set up Pango prerequisites */
font_desc = pango_font_description_copy (style->font_desc);
@@ -295,7 +293,6 @@ week_view_main_item_draw_day (EWeekViewMainItem *main_item,
}
pango_font_metrics_unref (font_metrics);
pango_font_description_free (font_desc);
- cairo_destroy (cr);
}
static void
@@ -368,7 +365,7 @@ week_view_main_item_update (GnomeCanvasItem *item,
static void
week_view_main_item_draw (GnomeCanvasItem *canvas_item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x,
gint y,
gint width,
@@ -399,7 +396,7 @@ week_view_main_item_draw (GnomeCanvasItem *canvas_item,
if (day_x < x + width && day_x + day_w >= x
&& day_y < y + height && day_y + day_h >= y) {
week_view_main_item_draw_day (
- main_item, day, &date, drawable,
+ main_item, day, &date, cr,
day_x - x, day_y - y, day_w, day_h);
}
g_date_add_days (&date, 1);
diff --git a/calendar/gui/e-week-view-titles-item.c b/calendar/gui/e-week-view-titles-item.c
index 2a5056d..5491d4e 100644
--- a/calendar/gui/e-week-view-titles-item.c
+++ b/calendar/gui/e-week-view-titles-item.c
@@ -115,7 +115,7 @@ week_view_titles_item_update (GnomeCanvasItem *item,
static void
week_view_titles_item_draw (GnomeCanvasItem *canvas_item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x,
gint y,
gint width,
@@ -130,13 +130,11 @@ week_view_titles_item_draw (GnomeCanvasItem *canvas_item,
gboolean abbreviated;
gint weekday;
PangoLayout *layout;
- cairo_t *cr;
titles_item = E_WEEK_VIEW_TITLES_ITEM (canvas_item);
week_view = e_week_view_titles_item_get_week_view (titles_item);
g_return_if_fail (week_view != NULL);
- cr = gdk_cairo_create (drawable);
cairo_set_line_width (cr, 1.0);
gtk_widget_get_allocation (
@@ -234,7 +232,6 @@ week_view_titles_item_draw (GnomeCanvasItem *canvas_item,
}
g_object_unref (layout);
- cairo_destroy (cr);
}
static GnomeCanvasItem *
diff --git a/libgnomecanvas/gnome-canvas-rect.c b/libgnomecanvas/gnome-canvas-rect.c
index 5d98136..29e4c29 100644
--- a/libgnomecanvas/gnome-canvas-rect.c
+++ b/libgnomecanvas/gnome-canvas-rect.c
@@ -171,7 +171,7 @@ gnome_canvas_rect_set_property (GObject *object,
case PROP_FILL_COLOR:
color_string = g_value_get_string (value);
if (color_string != NULL) {
- if (gdk_color_parse (color_string, &color)) {
+ if (!gdk_color_parse (color_string, &color)) {
g_warning (
"Failed to parse color '%s'",
color_string);
diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c
index 9509816..8e7308e 100644
--- a/widgets/table/e-table-header-utils.c
+++ b/widgets/table/e-table-header-utils.c
@@ -410,6 +410,4 @@ e_table_header_draw_button (cairo_t *cr, ETableCol *ecol,
}
g_object_unref (layout);
-
- cairo_destroy (cr);
}
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 0f43d72..b4afa8e 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -1730,7 +1730,7 @@ eti_draw_grid_line (ETableItem *eti, cairo_t *cr, GtkStyle *style,
}
static void
-eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint width, gint height)
+eti_draw (GnomeCanvasItem *item, cairo_t *cr, gint x, gint y, gint width, gint height)
{
ETableItem *eti = E_TABLE_ITEM (item);
const gint rows = eti->rows;
@@ -1746,10 +1746,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint wid
GtkWidget *canvas = GTK_WIDGET (item->canvas);
GtkStyle *style = gtk_widget_get_style (canvas);
gint height_extra = eti->horizontal_draw_grid ? 1 : 0;
- cairo_t *cr;
-
- cr = gdk_cairo_create (drawable);
-
+
/*
* Find out our real position after grouping
*/
@@ -1788,7 +1785,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint wid
* Nothing to paint
*/
if (first_col == -1)
- goto exit;
+ return;
/*
* Compute row span.
@@ -1797,7 +1794,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint wid
first_row = (y - floor (eti_base_y) - height_extra) / (ETI_ROW_HEIGHT (eti, -1) + height_extra);
last_row = (y + height - floor (eti_base_y) ) / (ETI_ROW_HEIGHT (eti, -1) + height_extra) + 1;
if (first_row > last_row)
- goto exit;
+ return;
y_offset = floor (eti_base_y) - y + height_extra + first_row * (ETI_ROW_HEIGHT (eti, -1) + height_extra);
if (first_row < 0)
first_row = 0;
@@ -1828,11 +1825,11 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint wid
last_row = row;
if (first_row == -1)
- goto exit;
+ return;
}
if (first_row == -1)
- goto exit;
+ return;
/*
* Draw cells
@@ -2024,9 +2021,6 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint wid
gdk_cairo_set_source_color (cr, &style->fg[GTK_STATE_NORMAL]);
cairo_stroke (cr);
}
-
-exit:
- cairo_destroy (cr);
}
static GnomeCanvasItem *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]