[librsvg: 23/36] filters/merge: remove interior mutability
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 23/36] filters/merge: remove interior mutability
- Date: Mon, 1 Jul 2019 01:55:34 +0000 (UTC)
commit 0949250c3c9e3f8bfded829343e3ac136ba3bb07
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Jun 30 16:28:49 2019 +0200
filters/merge: remove interior mutability
rsvg_internals/src/filters/merge.rs | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/rsvg_internals/src/filters/merge.rs b/rsvg_internals/src/filters/merge.rs
index 7a678e7e..c0118923 100644
--- a/rsvg_internals/src/filters/merge.rs
+++ b/rsvg_internals/src/filters/merge.rs
@@ -1,5 +1,3 @@
-use std::cell::RefCell;
-
use cairo::{self, ImageSurface};
use markup5ever::local_name;
@@ -21,7 +19,7 @@ pub struct Merge {
/// The `<feMergeNode>` element.
#[derive(Default)]
pub struct MergeNode {
- in_: RefCell<Option<Input>>,
+ in_: Option<Input>,
}
impl Default for Merge {
@@ -48,9 +46,7 @@ impl NodeTrait for MergeNode {
fn set_atts(&mut self, _parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
- local_name!("in") => {
- self.in_.replace(Some(Input::parse(attr, value)?));
- }
+ local_name!("in") => self.in_ = Some(Input::parse(attr, value)?),
_ => (),
}
}
@@ -67,7 +63,7 @@ impl MergeNode {
bounds: IRect,
output_surface: Option<SharedImageSurface>,
) -> Result<SharedImageSurface, FilterError> {
- let input = ctx.get_input(draw_ctx, self.in_.borrow().as_ref())?;
+ let input = ctx.get_input(draw_ctx, self.in_.as_ref())?;
if output_surface.is_none() {
return Ok(input.surface().clone());
@@ -131,7 +127,7 @@ impl Filter for Merge {
let input = ctx.get_input(
draw_ctx,
- child.borrow().get_impl::<MergeNode>().in_.borrow().as_ref(),
+ child.borrow().get_impl::<MergeNode>().in_.as_ref(),
)?;
bounds = bounds.add_input(&input);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]