[evolution/evolution-3-12] Correct draw of all-day events in a day/work-week view



commit 753b2e260072151f64bb257f09b0dbb7e7ca9558
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jul 10 17:39:56 2014 +0200

    Correct draw of all-day events in a day/work-week view
    
    I overlooked an issue when replacing GtkStyle with GtkStyleContext
    in this part, the all-day events were drawn always black, instead
    of with the background color of their calendar.

 calendar/gui/e-day-view-top-item.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index a70bc58..96d0ea9 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -153,8 +153,7 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
        PangoLayout *layout;
        GdkRGBA bg_color, rgba;
        cairo_pattern_t *pat;
-       guint16 red, green, blue;
-       gdouble cc = 65535.0;
+       gdouble red, green, blue;
        gdouble x0, y0, rect_height, rect_width, radius;
 
        day_view = e_day_view_top_item_get_day_view (top_item);
@@ -193,9 +192,9 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
                green = bg_color.green;
                blue = bg_color.blue;
        } else {
-               red = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].red;
-               green = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].green;
-               blue = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].blue;
+               red = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].red / 65535.0;
+               green = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].green / 65535.0;
+               blue = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].blue / 65535.0;
        }
 
        /* Fill the background with white to play with transparency */
@@ -226,7 +225,7 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
 
        draw_curved_rectangle (cr, x0, y0, rect_width, rect_height, radius);
 
-       cairo_set_source_rgb (cr, red / cc, green / cc, blue / cc);
+       cairo_set_source_rgb (cr, red, green, blue);
        cairo_set_line_width (cr, 1.5);
        cairo_stroke (cr);
        cairo_restore (cr);
@@ -247,13 +246,13 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
        pat = cairo_pattern_create_linear (
                item_x - x + 5.5, item_y + 2.5 - y,
                item_x - x + 5, item_y - y + item_h + 7.5);
-       cairo_pattern_add_color_stop_rgba (pat, 1, red / cc, green / cc, blue / cc, 0.8);
-       cairo_pattern_add_color_stop_rgba (pat, 0, red / cc, green / cc, blue / cc, 0.4);
+       cairo_pattern_add_color_stop_rgba (pat, 1, red, green, blue, 0.8);
+       cairo_pattern_add_color_stop_rgba (pat, 0, red, green, blue, 0.4);
        cairo_set_source (cr, pat);
        cairo_fill_preserve (cr);
        cairo_pattern_destroy (pat);
 
-       cairo_set_source_rgba (cr, red / cc, green / cc, blue / cc, 0);
+       cairo_set_source_rgba (cr, red, green, blue, 0);
        cairo_set_line_width (cr, 0.5);
        cairo_stroke (cr);
        cairo_restore (cr);


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