From: Pierre-Luc Beaudoin Date: Sun, 12 Apr 2009 01:38:45 +0000 (-0400) Subject: Fix coding style and remove hard coded values in the new error tile X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=108eaf3aa8effcc603ac3ecfb66e80e65edc657c;p=libchamplain Fix coding style and remove hard coded values in the new error tile --- diff --git a/champlain/champlain-network-map-source.c b/champlain/champlain-network-map-source.c index 72ef03a..edcbe65 100644 --- a/champlain/champlain-network-map-source.c +++ b/champlain/champlain-network-map-source.c @@ -360,31 +360,33 @@ create_error_tile (ChamplainTile* tile) ClutterActor *actor; cairo_t *cr; cairo_pattern_t *pat; + guint size; - actor = clutter_cairo_new (256, 256); + size = champlain_tile_get_size (tile); + actor = clutter_cairo_new (size, size); cr = clutter_cairo_create (CLUTTER_CAIRO(actor)); /* draw a linear gray to white pattern */ - pat = cairo_pattern_create_linear(128.0, 0.0, 256.0, 128.0); - cairo_pattern_add_color_stop_rgb(pat, 0, 0.686, 0.686, 0.686); - cairo_pattern_add_color_stop_rgb(pat, 1, 0.925, 0.925, 0.925); - cairo_set_source(cr, pat); - cairo_rectangle(cr, 0, 0, 256, 256); - cairo_fill(cr); + pat = cairo_pattern_create_linear (size / 2.0, 0.0, size, size / 2.0); + cairo_pattern_add_color_stop_rgb (pat, 0, 0.686, 0.686, 0.686); + cairo_pattern_add_color_stop_rgb (pat, 1, 0.925, 0.925, 0.925); + cairo_set_source (cr, pat); + cairo_rectangle (cr, 0, 0, size, size); + cairo_fill (cr); - cairo_pattern_destroy(pat); + cairo_pattern_destroy (pat); /* draw the red cross */ - cairo_set_source_rgb(cr, 0.424, 0.078, 0.078); + cairo_set_source_rgb (cr, 0.424, 0.078, 0.078); cairo_set_line_width (cr, 14.0); - cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND); - cairo_move_to(cr, 24, 24); - cairo_line_to(cr, 50, 50); - cairo_move_to(cr, 50, 24); - cairo_line_to(cr, 24, 50); - cairo_stroke(cr); - - cairo_destroy(cr); + cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); + cairo_move_to (cr, 24, 24); + cairo_line_to (cr, 50, 50); + cairo_move_to (cr, 50, 24); + cairo_line_to (cr, 24, 50); + cairo_stroke (cr); + + cairo_destroy (cr); champlain_tile_set_actor (tile, actor); clutter_actor_show (actor);