[librsvg/librsvg-2.50] Hide implementation details of FilterValueList
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.50] Hide implementation details of FilterValueList
- Date: Fri, 2 Oct 2020 19:24:35 +0000 (UTC)
commit f905a7facb8eb44709d8d81ecd98be1a64b137c9
Author: Sven Neumann <sven svenfoo org>
Date: Wed Sep 9 09:39:20 2020 +0200
Hide implementation details of FilterValueList
We can hide the fact that FilterValueList uses a Vector by providing
a method to create an Iterator over the contained values.
rsvg_internals/src/drawing_ctx.rs | 1 -
rsvg_internals/src/filter.rs | 7 ++++++-
2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index a4f359b5..3687e098 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -599,7 +599,6 @@ impl DrawingCtx {
)?;
let img_surface = filters
- .0
.iter()
.try_fold(
child_surface,
diff --git a/rsvg_internals/src/filter.rs b/rsvg_internals/src/filter.rs
index 6af6a9d2..abb34c8d 100644
--- a/rsvg_internals/src/filter.rs
+++ b/rsvg_internals/src/filter.rs
@@ -2,6 +2,7 @@
use cssparser::Parser;
use markup5ever::{expanded_name, local_name, namespace_url, ns};
+use std::slice::Iter;
use crate::allowed_url::Fragment;
use crate::bbox::BoundingBox;
@@ -196,7 +197,7 @@ pub enum FilterValue {
URL(Fragment),
}
#[derive(Debug, Clone, PartialEq)]
-pub struct FilterValueList(pub Vec<FilterValue>);
+pub struct FilterValueList(Vec<FilterValue>);
impl Default for FilterValueList {
fn default() -> FilterValueList {
@@ -209,6 +210,10 @@ impl FilterValueList {
self.0.is_empty()
}
+ pub fn iter(&self) -> Iter<FilterValue> {
+ self.0.iter()
+ }
+
/// Check that at least one filter URI exists and that all contained
/// URIs reference existing <filter> elements.
pub fn is_applicable(&self, node: &Node, acquired_nodes: &mut AcquiredNodes) -> bool {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]