[gnome-calendar/ui-rewrite] year-view: fixed drawing and colors
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/ui-rewrite] year-view: fixed drawing and colors
- Date: Wed, 24 Sep 2014 14:54:08 +0000 (UTC)
commit 2ec2dfaa014e4b8cba93b3f1ed6101e6267524f5
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Wed Sep 24 10:50:25 2014 -0400
year-view: fixed drawing and colors
src/gcal-year-view.c | 38 +++++++++++---------------------------
1 files changed, 11 insertions(+), 27 deletions(-)
---
diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c
index 87aa406..619aefe 100644
--- a/src/gcal-year-view.c
+++ b/src/gcal-year-view.c
@@ -751,7 +751,7 @@ gcal_year_view_draw_grid (GcalYearView *view,
&ligther_color);
gtk_style_context_get_color (context, state, &color);
gtk_style_context_get (context, state, "font", &font, NULL);
- cairo_set_source_rgb (cr, color.red, color.green, color.blue);
+ gdk_cairo_set_source_rgba (cr, &color);
pango_layout_set_font_description (layout, font);
@@ -777,11 +777,7 @@ gcal_year_view_draw_grid (GcalYearView *view,
last_cell = priv->start_mark_cell;
}
- cairo_set_source_rgba (cr,
- background_selected_color.red,
- background_selected_color.green,
- background_selected_color.blue,
- background_selected_color.alpha);
+ gdk_cairo_set_source_rgba (cr, &background_selected_color);
for (rows = 0; rows < last_cell / 6 - first_cell / 6 + 1; rows++)
{
@@ -803,10 +799,7 @@ gcal_year_view_draw_grid (GcalYearView *view,
cairo_restore (cr);
}
- cairo_set_source_rgb (cr,
- ligther_color.red,
- ligther_color.green,
- ligther_color.blue);
+ gdk_cairo_set_source_rgba (cr, &ligther_color);
/* drawing grid text */
for (i = 0; i < 2; i++)
@@ -815,10 +808,7 @@ gcal_year_view_draw_grid (GcalYearView *view,
{
if (priv->date->month == i * 6 + j + 1)
{
- cairo_set_source_rgb (cr,
- selected_color.red,
- selected_color.green,
- selected_color.blue);
+ gdk_cairo_set_source_rgba (cr, &selected_color);
}
pango_layout_set_text (layout, gcal_get_month_name (i * 6 + j), -1);
@@ -832,10 +822,7 @@ gcal_year_view_draw_grid (GcalYearView *view,
if (priv->date->month == i * 6 + j + 1)
{
- cairo_set_source_rgb (cr,
- ligther_color.red,
- ligther_color.green,
- ligther_color.blue);
+ gdk_cairo_set_source_rgba (cr, &ligther_color);
}
}
@@ -844,30 +831,27 @@ gcal_year_view_draw_grid (GcalYearView *view,
g_object_unref (layout);
/* drawing grid skel */
- cairo_set_line_width (cr, 0.3);
+ cairo_set_line_width (cr, 0.4);
/* vertical lines */
for (i = 0; i < 5; i++)
{
- //FIXME: ensure x coordinate has an integer value plus 0.4
- cairo_move_to (cr, (alloc->width / 6) * (i + 1) + 0.4, 0);
+ gint pos_x = (alloc->width / 6) * (i + 1);
+ cairo_move_to (cr, pos_x + 0.3, 0);
cairo_rel_line_to (cr, 0, alloc->height);
}
for (i = 0; i < 2; i++)
{
- //FIXME: ensure y coordinate has an integer value plus 0.4
- cairo_move_to (cr, 0, (alloc->height / 2) * i + 0.4);
+ gint pos_y = (alloc->height / 2) * i;
+ cairo_move_to (cr, 0, pos_y + 0.3);
cairo_rel_line_to (cr, alloc->width, 0);
}
cairo_stroke (cr);
/* drawing current month marker */
- cairo_set_source_rgb (cr,
- selected_color.red,
- selected_color.green,
- selected_color.blue);
+ gdk_cairo_set_source_rgba (cr, &selected_color);
/* Two pixel line on the selected day cell */
cairo_set_line_width (cr, 2.0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]