summaryrefslogtreecommitdiff
path: root/src/label-ellipse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/label-ellipse.c')
-rw-r--r--src/label-ellipse.c46
1 files changed, 34 insertions, 12 deletions
diff --git a/src/label-ellipse.c b/src/label-ellipse.c
index 5de25a7..0d38e3e 100644
--- a/src/label-ellipse.c
+++ b/src/label-ellipse.c
@@ -410,11 +410,11 @@ draw_shadow (glLabelObject *object,
glColorNode *shadow_color_node;
guint shadow_color;
gdouble shadow_opacity;
- guint shadow_line_color;
- guint shadow_fill_color;
gl_debug (DEBUG_LABEL, "START");
+ cairo_save (cr);
+
gl_label_object_get_size (object, &w, &h);
line_width = gl_label_object_get_line_width (object);
@@ -439,27 +439,49 @@ draw_shadow (glLabelObject *object,
shadow_color = GL_COLOR_SHADOW_MERGE_DEFAULT;
}
shadow_opacity = gl_label_object_get_shadow_opacity (object);
- shadow_line_color = gl_color_shadow (shadow_color_node->color, shadow_opacity, line_color_node->color);
- shadow_fill_color = gl_color_shadow (shadow_color_node->color, shadow_opacity, fill_color_node->color);
+ shadow_color = gl_color_set_opacity (shadow_color, shadow_opacity);
- gl_cairo_ellipse_path (cr, w/2, h/2);
+ cairo_set_source_rgba (cr, GL_COLOR_RGBA_ARGS (shadow_color));
+ if ( GL_COLOR_F_ALPHA (fill_color) )
+ {
+ if ( GL_COLOR_F_ALPHA (line_color) )
+ {
+ /* Has FILL and OUTLINE: adjust size to account for line width. */
+ cairo_translate (cr, -line_width/2, -line_width/2);
+ gl_cairo_ellipse_path (cr, (w+line_width)/2, (h+line_width)/2);
- /* Draw fill shadow */
- cairo_set_source_rgba (cr, GL_COLOR_RGBA_ARGS (shadow_fill_color));
- cairo_fill_preserve (cr);
+ }
+ else
+ {
+ /* Has FILL but no OUTLINE. */
+ gl_cairo_ellipse_path (cr, w/2, h/2);
+ }
- /* Draw outline shadow */
- cairo_set_source_rgba (cr, GL_COLOR_RGBA_ARGS (shadow_line_color));
- cairo_set_line_width (cr, line_width);
- cairo_stroke (cr);
+ /* Draw shadow */
+ cairo_fill (cr);
+ }
+ else
+ {
+ if ( GL_COLOR_F_ALPHA (line_color) )
+ {
+ /* Has only OUTLINE. */
+ gl_cairo_ellipse_path (cr, w/2, h/2);
+
+ /* Draw shadow of outline */
+ cairo_set_line_width (cr, line_width);
+ cairo_stroke (cr);
+ }
+ }
gl_color_node_free (&line_color_node);
gl_color_node_free (&fill_color_node);
gl_color_node_free (&shadow_color_node);
+ cairo_restore (cr);
+
gl_debug (DEBUG_LABEL, "END");
}