diff options
Diffstat (limited to 'rsvg_internals/src/filters/mod.rs')
-rw-r--r-- | rsvg_internals/src/filters/mod.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/rsvg_internals/src/filters/mod.rs b/rsvg_internals/src/filters/mod.rs index dab3e3c2..2edc51ed 100644 --- a/rsvg_internals/src/filters/mod.rs +++ b/rsvg_internals/src/filters/mod.rs @@ -44,12 +44,19 @@ trait Filter: NodeTrait { /// If this filter primitive can't be rendered for whatever reason (for instance, a required /// property hasn't been provided), an error is returned. fn render(&self, node: &RsvgNode, ctx: &FilterContext) -> Result<FilterResult, FilterError>; + + /// Returns `true` if this filter primitive is affected by the `color-interpolation-filters` + /// property. + /// + /// Primitives that do color blending (like `feComposite` or `feBlend`) should return `true` + /// here, whereas primitives that don't (like `feOffset`) should return `false`. + fn is_affected_by_color_interpolation_filters() -> bool; } /// The base filter primitive node containing common properties. struct Primitive { - // The purpose of this field is to pass this filter's render function to the C code. - render_function: RenderFunctionType, + // The purpose of this field is to pass this filter's function pointers to the C code. + filter_function_pointers: FilterFunctionPointers, x: Cell<Option<RsvgLength>>, y: Cell<Option<RsvgLength>>, @@ -77,7 +84,7 @@ impl Primitive { #[inline] fn new<T: Filter>() -> Primitive { Primitive { - render_function: render::<T>, + filter_function_pointers: FilterFunctionPointers::new::<T>(), x: Cell::new(None), y: Cell::new(None), @@ -167,7 +174,7 @@ impl NodeTrait for Primitive { #[inline] fn get_c_impl(&self) -> *const RsvgCNodeImpl { // The code that deals with the return value is in ffi.rs. - self.render_function as *const RenderFunctionType as *const RsvgCNodeImpl + &self.filter_function_pointers as *const FilterFunctionPointers as *const RsvgCNodeImpl } } |