diff options
author | Federico Mena Quintero <federico@gnome.org> | 2016-12-13 20:50:56 -0600 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2016-12-13 20:50:56 -0600 |
commit | c32694be3bf3355cb6c849577d7085173c94814e (patch) | |
tree | 0e5f36f7eae3e76b2f6bf7e23b3249170b3240e1 /rsvg-styles.h | |
parent | cd7028edb9d080f16b5b4c8e4185c94f09ab6885 (diff) | |
download | librsvg-c32694be3bf3355cb6c849577d7085173c94814e.tar.gz |
Be explicit about how stop-color and stop-opacity are inherited
These can live in the <stop> element attributes, or in its style="..."
attribute.
Neither of them inherits by default; they have to be explicitly
specified as "inherit" to do that.
Inheritance is from the gradient's parent element, not from where it is
referenced, hence the call to rsvg_state_reconstruct().
Also, stop-color can be currentColor.
We now have explicit enums to indicate all of these cases. Previously,
all the meanings were overloaded into state->has_stop_color and
state->has_stop_opacity, and those didn't handle all cases correctly.
Added the hexchat.svg icon to the tests, which is how I caught the lack
of proper handling for style="stop-color: ...;".
Diffstat (limited to 'rsvg-styles.h')
-rw-r--r-- | rsvg-styles.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/rsvg-styles.h b/rsvg-styles.h index b4d59624..8205d999 100644 --- a/rsvg-styles.h +++ b/rsvg-styles.h @@ -72,6 +72,19 @@ struct _RsvgVpathDash { double *dash; }; +typedef enum { + STOP_COLOR_UNSPECIFIED, + STOP_COLOR_SPECIFIED, + STOP_COLOR_INHERIT, + STOP_COLOR_CURRENT_COLOR +} StopColor; + +typedef enum { + STOP_OPACITY_UNSPECIFIED, + STOP_OPACITY_SPECIFIED, + STOP_OPACITY_INHERIT +} StopOpacity; + /* end libart theft... */ struct _RsvgState { @@ -143,8 +156,10 @@ struct _RsvgState { guint32 stop_color; /* rgb */ gboolean has_stop_color; + StopColor stop_color_mode; gint stop_opacity; /* 0..255 */ gboolean has_stop_opacity; + StopOpacity stop_opacity_mode; gboolean visible; gboolean has_visible; |