[librsvg: 18/36] filters/blend: remove interior mutability
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 18/36] filters/blend: remove interior mutability
- Date: Mon, 1 Jul 2019 01:55:09 +0000 (UTC)
commit fa2b3cd035269e65d21a8afbcd4a56ef9a779e7a
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Jun 30 16:05:40 2019 +0200
filters/blend: remove interior mutability
rsvg_internals/src/filters/blend.rs | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/rsvg_internals/src/filters/blend.rs b/rsvg_internals/src/filters/blend.rs
index 9eb0f9d6..7afa4868 100644
--- a/rsvg_internals/src/filters/blend.rs
+++ b/rsvg_internals/src/filters/blend.rs
@@ -1,5 +1,3 @@
-use std::cell::{Cell, RefCell};
-
use cairo;
use markup5ever::{local_name, LocalName};
@@ -27,8 +25,8 @@ enum Mode {
/// The `feBlend` filter primitive.
pub struct Blend {
base: PrimitiveWithInput,
- in2: RefCell<Option<Input>>,
- mode: Cell<Mode>,
+ in2: Option<Input>,
+ mode: Mode,
}
impl Default for Blend {
@@ -37,8 +35,8 @@ impl Default for Blend {
fn default() -> Blend {
Blend {
base: PrimitiveWithInput::new::<Self>(),
- in2: RefCell::new(None),
- mode: Cell::new(Mode::Normal),
+ in2: None,
+ mode: Mode::Normal,
}
}
}
@@ -52,9 +50,9 @@ impl NodeTrait for Blend {
for (attr, value) in pbag.iter() {
match attr {
local_name!("in2") => {
- self.in2.replace(Some(Input::parse(attr, value)?));
+ self.in2 = Some(Input::parse(attr, value)?);
}
- local_name!("mode") => self.mode.set(Mode::parse(attr, value)?),
+ local_name!("mode") => self.mode = Mode::parse(attr, value)?,
_ => (),
}
}
@@ -71,7 +69,7 @@ impl Filter for Blend {
draw_ctx: &mut DrawingCtx,
) -> Result<FilterResult, FilterError> {
let input = self.base.get_input(ctx, draw_ctx)?;
- let input_2 = ctx.get_input(draw_ctx, self.in2.borrow().as_ref())?;
+ let input_2 = ctx.get_input(draw_ctx, self.in2.as_ref())?;
let bounds = self
.base
.get_bounds(ctx)
@@ -108,7 +106,7 @@ impl Filter for Blend {
cr.clip();
input.surface().set_as_source_surface(&cr, 0f64, 0f64);
- cr.set_operator(self.mode.get().into());
+ cr.set_operator(self.mode.into());
cr.paint();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]