[gnome-calendar/ui-rewrite] gcal-year-view: refactored draw new-event marks



commit 2fe22ebee75bbf9762d3938a28b10b7c9d04a302
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Thu Jul 4 14:08:41 2013 -0400

    gcal-year-view: refactored draw new-event marks
    
    Make it more readable.

 src/gcal-year-view.c |   27 +++++++++------------------
 1 files changed, 9 insertions(+), 18 deletions(-)
---
diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c
index 5357e2b..52716d4 100644
--- a/src/gcal-year-view.c
+++ b/src/gcal-year-view.c
@@ -788,30 +788,20 @@ gcal_year_view_draw_grid (GcalYearView *view,
                              background_selected_color.blue,
                              background_selected_color.alpha);
 
-      for (rows = 0; rows < (last_cell / 6) - (first_cell / 6) + 1; rows++)
+      for (rows = 0; rows < last_cell / 6 - first_cell / 6 + 1; rows++)
         {
           gint first_point;
           gint last_point;
 
           first_point = (rows == 0) ? first_cell : ((first_cell / 6) + rows) * 6;
-          cairo_move_to (
-              cr,
-              (alloc->width / 6) * ( first_point % 6),
-              (alloc->height / 2) * ( first_point / 6) + 1);
-
           last_point = (rows == (last_cell / 6 - first_cell / 6)) ? last_cell : ((first_cell / 6) + rows) * 
6 + 5;
-          cairo_rel_line_to (cr,
-                             (alloc->width / 6) * (last_point - first_point + 1),
-                             0);
-          cairo_rel_line_to (cr,
-                             0,
-                             alloc->height / 2);
-          cairo_rel_line_to (cr,
-                             - (alloc->width / 6) * (last_point - first_point + 1),
-                             0);
-          cairo_rel_line_to (cr,
-                             0,
-                             - alloc->height / 2);
+
+          cairo_rectangle (cr,
+                           (alloc->width / 6) * ( first_point % 6),
+                           (alloc->height / 2) * ( first_point / 6) + 1,
+                           (alloc->width / 6) * (last_point - first_point + 1),
+                           alloc->height / 2);
+
           cairo_fill (cr);
         }
 
@@ -940,6 +930,7 @@ gcal_year_view_get_final_date (GcalView *view)
 
   return new_date;
 }
+
 static void
 gcal_year_view_mark_current_unit (GcalView *view,
                                   gint     *x,


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