diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /gfx/wr/wrench | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/wr/wrench')
24 files changed, 703 insertions, 3 deletions
diff --git a/gfx/wr/wrench/reftests/filters/reftest.list b/gfx/wr/wrench/reftests/filters/reftest.list index 493cb6ff8c..c0b3a74131 100644 --- a/gfx/wr/wrench/reftests/filters/reftest.list +++ b/gfx/wr/wrench/reftests/filters/reftest.list @@ -1,3 +1,12 @@ +fuzzy(2,10000) == svgfe-blenddarken-linear.yaml svgfe-blenddarken-linear-ref.yaml +fuzzy(2,10000) == svgfe-blendmultiply-linear.yaml svgfe-blendmultiply-linear-ref.yaml +fuzzy(2,10000) == svgfe-blendnormal-linear.yaml svgfe-blendnormal-linear-ref.yaml +fuzzy(2,10000) == svgfe-colormatrix.yaml svgfe-colormatrix-ref.yaml +fuzzy(4,10000) == svgfe-dropshadow.yaml svgfe-dropshadow-ref.yaml +fuzzy(2,10000) == svgfe-opacity-linear.yaml svgfe-opacity-linear-ref.yaml +fuzzy(2,10000) == svgfe-opacity.yaml svgfe-opacity-ref.yaml +fuzzy(12,10000) == svgfe-subregion-bigger.yaml svgfe-subregion-bigger-ref.yaml +fuzzy(12,10000) == svgfe-subregion-offset-stacking-context.yaml svgfe-subregion-offset-stacking-context-ref.yaml == filter-grayscale.yaml filter-grayscale-ref.yaml platform(linux,mac) == draw_calls(7) color_targets(7) alpha_targets(0) filter-blur.yaml filter-blur.png platform(linux,mac) == filter-blur-downscale-fractional.yaml filter-blur-downscale-fractional.png diff --git a/gfx/wr/wrench/reftests/filters/svgfe-blenddarken-linear-ref.yaml b/gfx/wr/wrench/reftests/filters/svgfe-blenddarken-linear-ref.yaml new file mode 100644 index 0000000000..4e828d2c98 --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-blenddarken-linear-ref.yaml @@ -0,0 +1,9 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 0, 120, 120] + items: + - type: rect + bounds: [10, 10, 100, 100] + color: [164, 82, 95, 1] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-blenddarken-linear.yaml b/gfx/wr/wrench/reftests/filters/svgfe-blenddarken-linear.yaml new file mode 100644 index 0000000000..063cbc89d9 --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-blenddarken-linear.yaml @@ -0,0 +1,21 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 0, 120, 120] + filters: + - svgfe: SourceGraphic + - svgfe: SourceAlpha + - svgfe: flood + linear: true + subregion: [10, 10, 100, 100] + color: [192, 96, 128, 1] + - svgfe: blenddarken + linear: true + subregion: [0, 0, 120, 120] + in: 0 + in2: 2 + items: + - type: rect + bounds: [10, 10, 100, 100] + color: [128, 64, 32, 0.5] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-blendmultiply-linear-ref.yaml b/gfx/wr/wrench/reftests/filters/svgfe-blendmultiply-linear-ref.yaml new file mode 100644 index 0000000000..de4d203f40 --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-blendmultiply-linear-ref.yaml @@ -0,0 +1,9 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 0, 120, 120] + items: + - type: rect + bounds: [10, 10, 100, 100] + color: [153, 70, 93, 1] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-blendmultiply-linear.yaml b/gfx/wr/wrench/reftests/filters/svgfe-blendmultiply-linear.yaml new file mode 100644 index 0000000000..c7deb2b4a7 --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-blendmultiply-linear.yaml @@ -0,0 +1,21 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 0, 120, 120] + filters: + - svgfe: SourceGraphic + - svgfe: SourceAlpha + - svgfe: flood + linear: true + subregion: [10, 10, 100, 100] + color: [192, 96, 128, 1] + - svgfe: blendmultiply + linear: true + subregion: [10, 10, 100, 100] + in: 0 + in2: 2 + items: + - type: rect + bounds: [10, 10, 100, 100] + color: [128, 64, 32, 0.5] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-blendnormal-linear-ref.yaml b/gfx/wr/wrench/reftests/filters/svgfe-blendnormal-linear-ref.yaml new file mode 100644 index 0000000000..4e828d2c98 --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-blendnormal-linear-ref.yaml @@ -0,0 +1,9 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 0, 120, 120] + items: + - type: rect + bounds: [10, 10, 100, 100] + color: [164, 82, 95, 1] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-blendnormal-linear.yaml b/gfx/wr/wrench/reftests/filters/svgfe-blendnormal-linear.yaml new file mode 100644 index 0000000000..c872e5031d --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-blendnormal-linear.yaml @@ -0,0 +1,21 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 0, 120, 120] + filters: + - svgfe: SourceGraphic + - svgfe: SourceAlpha + - svgfe: flood + linear: true + subregion: [10, 10, 100, 100] + color: [192, 96, 128, 1] + - svgfe: blendnormal + linear: true + subregion: [10, 10, 100, 100] + in: 0 + in2: 2 + items: + - type: rect + bounds: [10, 10, 100, 100] + color: [128, 64, 32, 0.5] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-colormatrix-ref.yaml b/gfx/wr/wrench/reftests/filters/svgfe-colormatrix-ref.yaml new file mode 100644 index 0000000000..b0246c8333 --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-colormatrix-ref.yaml @@ -0,0 +1,10 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 0, 120, 120] + items: + - type: rect + bounds: [10, 10, 100, 100] + # note: this is sRGB converted to match linear result of sRGB 64*2,32*2,16*2 + color: [90, 47, 26, 1] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-colormatrix.yaml b/gfx/wr/wrench/reftests/filters/svgfe-colormatrix.yaml new file mode 100644 index 0000000000..be0da63a59 --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-colormatrix.yaml @@ -0,0 +1,18 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 0, 120, 120] + filters: + - svgfe: SourceGraphic + - svgfe: SourceAlpha + - svgfe: colormatrix + linear: true, + subregion: [0, 0, 120, 120] + in: 0 + # note this is transposed to be suitable for shader, not SVG order + matrix: [2,0,0,0, 0,2,0,0, 0,0,2,0, 0,0,0,1, 0,0,0,0] + items: + - type: rect + bounds: [10, 10, 100, 100] + color: [64, 32, 16, 1] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-dropshadow-ref.yaml b/gfx/wr/wrench/reftests/filters/svgfe-dropshadow-ref.yaml new file mode 100644 index 0000000000..e14d6a1f18 --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-dropshadow-ref.yaml @@ -0,0 +1,16 @@ +--- +root: + items: + - type: stacking-context + bounds: [10, 10, 200, 200] + filters: drop-shadow([20, 20], 10, red) + items: + - type: stacking-context + bounds: [10, 10, 200, 200] + items: + - type: rect + bounds: [10, 10, 100, 100] + color: [127, 127, 127, 1] + - type: rect + bounds: [50, 30, 100, 60] + color: [192, 192, 192, 1] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-dropshadow.yaml b/gfx/wr/wrench/reftests/filters/svgfe-dropshadow.yaml new file mode 100644 index 0000000000..b2f5278c1f --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-dropshadow.yaml @@ -0,0 +1,27 @@ +--- +root: + items: + - type: stacking-context + bounds: [10, 10, 510, 510] + filters: + - svgfe: SourceGraphic + - svgfe: SourceAlpha + - svgfe: dropshadow + linear: false + subregion: [-20, -20, 320, 320] + color: red + dx: 20 + dy: 20 + std_deviation_x: 10 + std_deviation_y: 10 + in: 0 + items: + - type: stacking-context + bounds: [10, 10, 150, 110] + items: + - type: rect + bounds: [10, 10, 100, 100] + color: [127, 127, 127, 1] + - type: rect + bounds: [50, 30, 100, 60] + color: [192, 192, 192, 1] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-opacity-linear-ref.yaml b/gfx/wr/wrench/reftests/filters/svgfe-opacity-linear-ref.yaml new file mode 100644 index 0000000000..08fa2f4706 --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-opacity-linear-ref.yaml @@ -0,0 +1,9 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 0, 120, 120] + items: + - type: rect + bounds: [10, 10, 100, 100] + color: [128, 64, 32, 0.5] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-opacity-linear.yaml b/gfx/wr/wrench/reftests/filters/svgfe-opacity-linear.yaml new file mode 100644 index 0000000000..8ac12d37c7 --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-opacity-linear.yaml @@ -0,0 +1,20 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 0, 120, 120] + items: + - type: stacking-context + bounds: [10, 10, 100, 100] + filters: + - svgfe: SourceGraphic + - svgfe: SourceAlpha + - svgfe: opacity + linear: true, + subregion: [0, 0, 400, 400] + in: 0 + value: 0.5 + items: + - type: rect + bounds: [0, 0, 100, 100] + color: [128, 64, 32, 1] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-opacity-ref.yaml b/gfx/wr/wrench/reftests/filters/svgfe-opacity-ref.yaml new file mode 100644 index 0000000000..1395fb6dd3 --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-opacity-ref.yaml @@ -0,0 +1,9 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 0, 100, 100] + items: + - type: rect + bounds: [0, 0, 100, 100] + color: [128, 0, 0, 0.5] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-opacity.yaml b/gfx/wr/wrench/reftests/filters/svgfe-opacity.yaml new file mode 100644 index 0000000000..c8c3ab7dba --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-opacity.yaml @@ -0,0 +1,17 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 0, 100, 100] + filters: + - svgfe: SourceGraphic + - svgfe: SourceAlpha + - svgfe: opacity + linear: false + subregion: [0, 0, 100, 100] + in: 0 + value: 0.5 + items: + - type: rect + bounds: [0, 0, 100, 100] + color: [128, 0, 0, 1] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-subregion-bigger-ref.yaml b/gfx/wr/wrench/reftests/filters/svgfe-subregion-bigger-ref.yaml new file mode 100644 index 0000000000..676518b4ed --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-subregion-bigger-ref.yaml @@ -0,0 +1,15 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 50, 200, 100] + items: + - type: rect + bounds: [10, 10, 80, 100] + color: [255, 0, 0, 0.7] + - type: rect + bounds: [50, 10, 80, 100] + color: [0, 255, 0, 0.7] + - type: rect + bounds: [90, 10, 80, 100] + color: [0, 0, 255, 0.7] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-subregion-bigger.yaml b/gfx/wr/wrench/reftests/filters/svgfe-subregion-bigger.yaml new file mode 100644 index 0000000000..a54c3f59ea --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-subregion-bigger.yaml @@ -0,0 +1,35 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 50, 800, 800] + filters: + - svgfe: SourceGraphic + - svgfe: SourceAlpha + - svgfe: flood + linear: false + # this is expected to be at 10,60 + subregion: [10, 10, 80, 100] + color: [255, 0, 0, 0.7] + - svgfe: flood + linear: false + # this is expected to be at 50,60 + subregion: [50, 10, 80, 100] + color: [0, 255, 0, 0.7] + - svgfe: blendnormal + linear: false + # this is expected to be at 10,60 + subregion: [10, 10, 160, 100] + in: 3 + in2: 2 + - svgfe: blendnormal + linear: false + # this is expected to be at 10,60 + subregion: [10, 10, 160, 100] + in: 0 + in2: 4 + items: + - type: rect + # this is expected to be at 90,60 + bounds: [90, 10, 80, 100] + color: [0, 0, 255, 0.7] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-subregion-offset-stacking-context-ref.yaml b/gfx/wr/wrench/reftests/filters/svgfe-subregion-offset-stacking-context-ref.yaml new file mode 100644 index 0000000000..0020079d51 --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-subregion-offset-stacking-context-ref.yaml @@ -0,0 +1,21 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 0, 800, 800] + items: + - type: rect + bounds: [0, 200, 800, 5] + color: [64, 64, 64, 1] + - type: rect + bounds: [100, 500, 100, 100] + color: [0, 0, 255, 1] + - type: rect + bounds: [0, 500, 90, 5] + color: [0, 0, 255, 1] + - type: rect + bounds: [0, 0, 90, 5] + color: [255, 0, 0, 1] + - type: rect + bounds: [0, 300, 90, 5] + color: [0, 255, 0, 1] diff --git a/gfx/wr/wrench/reftests/filters/svgfe-subregion-offset-stacking-context.yaml b/gfx/wr/wrench/reftests/filters/svgfe-subregion-offset-stacking-context.yaml new file mode 100644 index 0000000000..106e629432 --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svgfe-subregion-offset-stacking-context.yaml @@ -0,0 +1,51 @@ +--- +root: + items: + - type: stacking-context + bounds: [0, 0, 800, 800] + items: + - type: stacking-context + bounds: [0, 200, 800, 800] + items: + - type: stacking-context + bounds: [0, 0, 800, 800] + filters: + - svgfe: SourceGraphic + - svgfe: SourceAlpha + - svgfe: flood + color: [64, 64, 64, 1] + # this is expected to show up at 0,200 + subregion: [0, 0, 800, 5] + - svgfe: flood + color: [127, 127, 127, 1] + # this is expected to show up at 100,500 and be completely + # hidden by the blue rect (SourceGraphic) + subregion: [100, 300, 90, 100] + - svgfe: compositeover + linear: false + subregion: [0, 0, 800, 800] + in: 3 + in2: 2 + - svgfe: compositeover + linear: false + subregion: [0, 0, 800, 800] + in: 0 + in2: 4 + items: + - type: rect + # blue rect is expected to show up at 100,500, this should + # hide the gray rect + bounds: [100, 300, 100, 100] + color: [0, 0, 255, 1] + - type: rect + # this is expected to show up at 0,500 + bounds: [0, 300, 90, 5] + color: [0, 0, 255, 1] + - type: rect + # this is expected to show up at 0,0 + bounds: [0, 0, 90, 5] + color: [255, 0, 0, 1] + - type: rect + # this is expected to show up at 0,300 + bounds: [0, 300, 90, 5] + color: [0, 255, 0, 1] diff --git a/gfx/wr/wrench/reftests/gradient/radial-border-radius-large-ref.png b/gfx/wr/wrench/reftests/gradient/radial-border-radius-large-ref.png Binary files differnew file mode 100644 index 0000000000..b86542ad0b --- /dev/null +++ b/gfx/wr/wrench/reftests/gradient/radial-border-radius-large-ref.png diff --git a/gfx/wr/wrench/reftests/gradient/radial-border-radius-large.yaml b/gfx/wr/wrench/reftests/gradient/radial-border-radius-large.yaml new file mode 100644 index 0000000000..ed052f4bb4 --- /dev/null +++ b/gfx/wr/wrench/reftests/gradient/radial-border-radius-large.yaml @@ -0,0 +1,21 @@ +# This test contains a radial gradient with rounded corners. +# The primitive is large enough to exercise the quad nine-patch +# code path. +# In addition the primitive contains a large solid color portion +# causing the gradient optimization to split it into two primitives. +--- +root: + items: + - type: clip + id: 5 + complex: + - rect: [10, 10, 750, 500] + radius: 32 + - type: radial-gradient + bounds: 10 10 750 500 + center: 0 0 + radius: 400 350 + stops: [0.0, red, 1.0, blue] + clip-chain: [5] + + diff --git a/gfx/wr/wrench/reftests/gradient/reftest.list b/gfx/wr/wrench/reftests/gradient/reftest.list index 5c55c29b06..c33fec2ebe 100644 --- a/gfx/wr/wrench/reftests/gradient/reftest.list +++ b/gfx/wr/wrench/reftests/gradient/reftest.list @@ -82,13 +82,14 @@ fuzzy(1,7) == tiling-conic-3.yaml tiling-conic-3-ref.yaml platform(linux,mac) == linear-aligned-border-radius.yaml linear-aligned-border-radius.png # interpolation fuzz from sampling texture-baked gradient ramps platform(linux,mac) fuzzy-range(<=1,*1404) == repeat-border-radius.yaml repeat-border-radius.png +fuzzy(3,6000) == radial-border-radius-large.yaml radial-border-radius-large-ref.png == conic.yaml conic-ref.yaml fuzzy(1,57) == conic-simple.yaml conic-simple.png fuzzy(255,302) == conic-angle.yaml conic-angle.png == conic-center.yaml conic-center.png fuzzy(1,2) == conic-angle-wraparound.yaml conic-angle.yaml -fuzzy-if(env(android,device),254,146) fuzzy-if(not(env(android,device)),1,1) == conic-angle-wraparound-negative.yaml conic-angle.yaml # Android device is Samsung Galaxy A51 +fuzzy-if(env(android,device),255,155) fuzzy-if(not(env(android,device)),1,1) == conic-angle-wraparound-negative.yaml conic-angle.yaml # Android device is Samsung Galaxy A51 fuzzy(1,333) == conic-color-wheel.yaml conic-color-wheel.png # gradient caching tests @@ -118,8 +119,8 @@ fuzzy-range(<=1,1) == gradient_cache_hardstop_clip.yaml gradient_cache_hardstop_ # Exercise the cached gradient scaling code path fuzzy(2,23000) == linear-large.yaml linear-large-ref.yaml == conic-large.yaml conic-large-ref.yaml -fuzzy-if(env(android,device),254,1) == conic-large-hard-stop.yaml conic-large-hard-stop-ref.yaml # Android device is Samsung Galaxy A51 -fuzzy(1,7000) == radial-large.yaml radial-large-ref.png +fuzzy-if(env(android,device),255,1) == conic-large-hard-stop.yaml conic-large-hard-stop-ref.yaml # Android device is Samsung Galaxy A51 +fuzzy(1,80000) == radial-large.yaml radial-large-ref.png # crash tests == linear-far-endpoints.yaml linear-far-endpoints.yaml diff --git a/gfx/wr/wrench/src/yaml_frame_reader.rs b/gfx/wr/wrench/src/yaml_frame_reader.rs index e67e749d56..0afe3968ee 100644 --- a/gfx/wr/wrench/src/yaml_frame_reader.rs +++ b/gfx/wr/wrench/src/yaml_frame_reader.rs @@ -1685,6 +1685,7 @@ impl YamlFrameReader { yaml["horizontal-offset-bounds"].as_sticky_offset_bounds(), yaml["previously-applied-offset"].as_vector().unwrap_or_else(LayoutVector2D::zero), self.next_spatial_key(), + None, ); if let Some(numeric_id) = numeric_id { diff --git a/gfx/wr/wrench/src/yaml_helper.rs b/gfx/wr/wrench/src/yaml_helper.rs index c28fad04ce..793c8e6023 100644 --- a/gfx/wr/wrench/src/yaml_helper.rs +++ b/gfx/wr/wrench/src/yaml_helper.rs @@ -9,6 +9,7 @@ use std::str::FromStr; use webrender::api::*; use webrender::api::units::*; use yaml_rust::{Yaml, YamlLoader}; +use log::Level; pub trait YamlHelper { fn as_f32(&self) -> Option<f32>; @@ -33,6 +34,7 @@ pub trait YamlHelper { fn as_transform_style(&self) -> Option<TransformStyle>; fn as_raster_space(&self) -> Option<RasterSpace>; fn as_clip_mode(&self) -> Option<ClipMode>; + fn as_graph_picture_reference(&self) -> Option<FilterOpGraphPictureReference>; fn as_mix_blend_mode(&self) -> Option<MixBlendMode>; fn as_filter_op(&self) -> Option<FilterOp>; fn as_vec_filter_op(&self) -> Option<Vec<FilterOp>>; @@ -537,7 +539,335 @@ impl YamlHelper for Yaml { self.as_str().and_then(StringEnum::from_str) } + fn as_graph_picture_reference(&self) -> Option<FilterOpGraphPictureReference> { + match self.as_i64() { + Some(n) => Some(FilterOpGraphPictureReference{ + buffer_id: FilterOpGraphPictureBufferId::BufferId(n as i16), + }), + None => None, + } + } + fn as_filter_op(&self) -> Option<FilterOp> { + if let Some(filter_op) = self["svgfe"].as_str() { + let subregion = self["subregion"].as_rect().unwrap_or( + LayoutRect::new( + LayoutPoint::new(0.0, 0.0), + LayoutPoint::new(1024.0, 1024.0), + )); + + let node = FilterOpGraphNode { + linear: self["linear"].as_bool().unwrap_or(true), + subregion, + input: self["in"].as_graph_picture_reference().unwrap_or( + FilterOpGraphPictureReference{ + buffer_id: FilterOpGraphPictureBufferId::None, + }), + input2: self["in2"].as_graph_picture_reference().unwrap_or( + FilterOpGraphPictureReference{ + buffer_id: FilterOpGraphPictureBufferId::None, + }), + }; + let debug_print_input = |input: FilterOpGraphPictureReference| -> String { + match input.buffer_id { + FilterOpGraphPictureBufferId::BufferId(id) => format!("BufferId{}", id), + FilterOpGraphPictureBufferId::None => "None".into(), + } + }; + log!(Level::Debug, "svgfe parsed: {} linear: {} in: {} in2: {} subregion: [{}, {}, {}, {}]", + filter_op, node.linear, + debug_print_input(node.input), debug_print_input(node.input2), + node.subregion.min.x, node.subregion.min.y, node.subregion.max.x, node.subregion.max.y, + ); + return match filter_op { + "identity" => Some(FilterOp::SVGFEIdentity{node}), + "opacity" => { + let value = self["value"].as_f32().unwrap(); + Some(FilterOp::SVGFEOpacity{node, valuebinding: value.into(), value}) + }, + "toalpha" => Some(FilterOp::SVGFEToAlpha{node}), + "blendcolor" => Some(FilterOp::SVGFEBlendColor{node}), + "blendcolorburn" => Some(FilterOp::SVGFEBlendColorBurn{node}), + "blendcolordodge" => Some(FilterOp::SVGFEBlendColorDodge{node}), + "blenddarken" => Some(FilterOp::SVGFEBlendDarken{node}), + "blenddifference" => Some(FilterOp::SVGFEBlendDifference{node}), + "blendexclusion" => Some(FilterOp::SVGFEBlendExclusion{node}), + "blendhardlight" => Some(FilterOp::SVGFEBlendHardLight{node}), + "blendhue" => Some(FilterOp::SVGFEBlendHue{node}), + "blendlighten" => Some(FilterOp::SVGFEBlendLighten{node}), + "blendluminosity" => Some(FilterOp::SVGFEBlendLuminosity{node}), + "blendmultiply" => Some(FilterOp::SVGFEBlendMultiply{node}), + "blendnormal" => Some(FilterOp::SVGFEBlendNormal{node}), + "blendoverlay" => Some(FilterOp::SVGFEBlendOverlay{node}), + "blendsaturation" => Some(FilterOp::SVGFEBlendSaturation{node}), + "blendscreen" => Some(FilterOp::SVGFEBlendScreen{node}), + "blendsoftlight" => Some(FilterOp::SVGFEBlendSoftLight{node}), + "colormatrix" => { + let m: Vec<f32> = self["matrix"].as_vec_f32().unwrap(); + let mut matrix: [f32; 20] = [0.0; 20]; + matrix.clone_from_slice(&m); + Some(FilterOp::SVGFEColorMatrix{node, values: matrix}) + } + "componenttransfer" => Some(FilterOp::SVGFEComponentTransfer{node}), + "compositearithmetic" => { + let k: Vec<f32> = self["k"].as_vec_f32().unwrap(); + Some(FilterOp::SVGFECompositeArithmetic{ + node, + k1: k[0], + k2: k[1], + k3: k[2], + k4: k[3], + }) + } + "compositeatop" => Some(FilterOp::SVGFECompositeATop{node}), + "compositein" => Some(FilterOp::SVGFECompositeIn{node}), + "compositelighter" => Some(FilterOp::SVGFECompositeLighter{node}), + "compositeout" => Some(FilterOp::SVGFECompositeOut{node}), + "compositeover" => Some(FilterOp::SVGFECompositeOver{node}), + "compositexor" => Some(FilterOp::SVGFECompositeXOR{node}), + "convolvematrixedgemodeduplicate" => { + let order_x = self["order_x"].as_i64().unwrap() as i32; + let order_y = self["order_y"].as_i64().unwrap() as i32; + let m: Vec<f32> = self["kernel"].as_vec_f32().unwrap(); + let mut kernel: [f32; 25] = [0.0; 25]; + kernel.clone_from_slice(&m); + let divisor = self["divisor"].as_f32().unwrap(); + let bias = self["bias"].as_f32().unwrap(); + let target_x = self["target_x"].as_i64().unwrap() as i32; + let target_y = self["target_y"].as_i64().unwrap() as i32; + let kernel_unit_length_x = self["kernel_unit_length_x"].as_f32().unwrap(); + let kernel_unit_length_y = self["kernel_unit_length_y"].as_f32().unwrap(); + let preserve_alpha = match self["preserve_alpha"].as_bool() { + Some(true) => 1, + Some(false) => 0, + _ => 1, + }; + Some(FilterOp::SVGFEConvolveMatrixEdgeModeDuplicate{ + node, order_x, order_y, kernel, divisor, bias, + target_x, target_y, kernel_unit_length_x, + kernel_unit_length_y, preserve_alpha}) + }, + "convolvematrixedgemodenone" => { + let order_x = self["order_x"].as_i64().unwrap() as i32; + let order_y = self["order_y"].as_i64().unwrap() as i32; + let m: Vec<f32> = self["kernel"].as_vec_f32().unwrap(); + let mut kernel: [f32; 25] = [0.0; 25]; + kernel.clone_from_slice(&m); + let divisor = self["divisor"].as_f32().unwrap(); + let bias = self["bias"].as_f32().unwrap(); + let target_x = self["target_x"].as_i64().unwrap() as i32; + let target_y = self["target_y"].as_i64().unwrap() as i32; + let kernel_unit_length_x = self["kernel_unit_length_x"].as_f32().unwrap(); + let kernel_unit_length_y = self["kernel_unit_length_y"].as_f32().unwrap(); + let preserve_alpha = match self["preserve_alpha"].as_bool() { + Some(true) => 1, + Some(false) => 0, + _ => 1, + }; + Some(FilterOp::SVGFEConvolveMatrixEdgeModeNone{ + node, order_x, order_y, kernel, divisor, bias, + target_x, target_y, kernel_unit_length_x, + kernel_unit_length_y, preserve_alpha}) + }, + "convolvematrixedgemodewrap" => { + let order_x = self["order_x"].as_i64().unwrap() as i32; + let order_y = self["order_y"].as_i64().unwrap() as i32; + let m: Vec<f32> = self["kernel"].as_vec_f32().unwrap(); + let mut kernel: [f32; 25] = [0.0; 25]; + kernel.clone_from_slice(&m); + let divisor = self["divisor"].as_f32().unwrap(); + let bias = self["bias"].as_f32().unwrap(); + let target_x = self["target_x"].as_i64().unwrap() as i32; + let target_y = self["target_y"].as_i64().unwrap() as i32; + let kernel_unit_length_x = self["kernel_unit_length_x"].as_f32().unwrap(); + let kernel_unit_length_y = self["kernel_unit_length_y"].as_f32().unwrap(); + let preserve_alpha = match self["preserve_alpha"].as_bool() { + Some(true) => 1, + Some(false) => 0, + _ => 1, + }; + Some(FilterOp::SVGFEConvolveMatrixEdgeModeWrap{ + node, order_x, order_y, kernel, divisor, bias, + target_x, target_y, kernel_unit_length_x, + kernel_unit_length_y, preserve_alpha}) + }, + "diffuselightingdistant" => { + let surface_scale = self["surface_scale"].as_f32().unwrap(); + let diffuse_constant = self["diffuse_constant"].as_f32().unwrap(); + let kernel_unit_length_x = self["kernel_unit_length_x"].as_f32().unwrap(); + let kernel_unit_length_y = self["kernel_unit_length_y"].as_f32().unwrap(); + let azimuth = self["azimuth"].as_f32().unwrap(); + let elevation = self["elevation"].as_f32().unwrap(); + Some(FilterOp::SVGFEDiffuseLightingDistant{ + node, surface_scale, diffuse_constant, + kernel_unit_length_x, kernel_unit_length_y, + azimuth, elevation}) + }, + "diffuselightingpoint" => { + let surface_scale = self["surface_scale"].as_f32().unwrap(); + let diffuse_constant = self["diffuse_constant"].as_f32().unwrap(); + let kernel_unit_length_x = self["kernel_unit_length_x"].as_f32().unwrap(); + let kernel_unit_length_y = self["kernel_unit_length_y"].as_f32().unwrap(); + let x = self["x"].as_f32().unwrap(); + let y = self["y"].as_f32().unwrap(); + let z = self["z"].as_f32().unwrap(); + Some(FilterOp::SVGFEDiffuseLightingPoint{ + node, surface_scale, diffuse_constant, + kernel_unit_length_x, kernel_unit_length_y, x, y, z}) + }, + "diffuselightingspot" => { + let surface_scale = self["surface_scale"].as_f32().unwrap(); + let diffuse_constant = self["diffuse_constant"].as_f32().unwrap(); + let kernel_unit_length_x = self["kernel_unit_length_x"].as_f32().unwrap(); + let kernel_unit_length_y = self["kernel_unit_length_y"].as_f32().unwrap(); + let x = self["x"].as_f32().unwrap(); + let y = self["y"].as_f32().unwrap(); + let z = self["z"].as_f32().unwrap(); + let points_at_x = self["points_at_x"].as_f32().unwrap(); + let points_at_y = self["points_at_y"].as_f32().unwrap(); + let points_at_z = self["points_at_z"].as_f32().unwrap(); + let cone_exponent = self["cone_exponent"].as_f32().unwrap(); + let limiting_cone_angle = self["limiting_cone_angle"].as_f32().unwrap(); + Some(FilterOp::SVGFEDiffuseLightingSpot{ + node, surface_scale, diffuse_constant, + kernel_unit_length_x, kernel_unit_length_y, x, y, z, + points_at_x, points_at_y, points_at_z, cone_exponent, + limiting_cone_angle}) + }, + "displacementmap" => { + let scale = self["scale"].as_f32().unwrap(); + let x_channel_selector = self["x_channel_selector"].as_i64().unwrap() as u32; + let y_channel_selector = self["y_channel_selector"].as_i64().unwrap() as u32; + Some(FilterOp::SVGFEDisplacementMap{node, scale, x_channel_selector, y_channel_selector}) + }, + "dropshadow" => { + let color = self["color"].as_colorf().unwrap(); + let dx = self["dx"].as_f32().unwrap(); + let dy = self["dy"].as_f32().unwrap(); + let std_deviation_x = self["std_deviation_x"].as_f32().unwrap(); + let std_deviation_y = self["std_deviation_y"].as_f32().unwrap(); + Some(FilterOp::SVGFEDropShadow{node, color, dx, dy, std_deviation_x, std_deviation_y}) + }, + "flood" => Some(FilterOp::SVGFEFlood{node, color: self["color"].as_colorf().unwrap()}), + "gaussianblur" => { + let std_deviation_x = self["std_deviation_x"].as_f32().unwrap(); + let std_deviation_y = self["std_deviation_y"].as_f32().unwrap(); + Some(FilterOp::SVGFEGaussianBlur{node, std_deviation_x, std_deviation_y}) + }, + "image" => { + let sampling_filter = match self["sampling_filter"].as_str() { + Some("GOOD") => 0, + Some("LINEAR") => 1, + Some("POINT") => 2, + _ => 0, + }; + let m: Vec<f32> = self["matrix"].as_vec_f32().unwrap(); + let mut matrix: [f32; 6] = [0.0; 6]; + matrix.clone_from_slice(&m); + Some(FilterOp::SVGFEImage{node, sampling_filter, matrix}) + }, + "morphologydilate" => { + let radius_x = self["radius_x"].as_f32().unwrap(); + let radius_y = self["radius_y"].as_f32().unwrap(); + Some(FilterOp::SVGFEMorphologyDilate{node, radius_x, radius_y}) + }, + "morphologyerode" => { + let radius_x = self["radius_x"].as_f32().unwrap(); + let radius_y = self["radius_y"].as_f32().unwrap(); + Some(FilterOp::SVGFEMorphologyErode{node, radius_x, radius_y}) + }, + "offset" => { + let offset = self["offset"].as_vec_f32().unwrap(); + Some(FilterOp::SVGFEOffset{node, offset_x: offset[0], offset_y: offset[1]}) + }, + "SourceAlpha" => Some(FilterOp::SVGFESourceAlpha{node}), + "SourceGraphic" => Some(FilterOp::SVGFESourceGraphic{node}), + "sourcealpha" => Some(FilterOp::SVGFESourceAlpha{node}), + "sourcegraphic" => Some(FilterOp::SVGFESourceGraphic{node}), + "specularlightingdistant" => { + let surface_scale = self["surface_scale"].as_f32().unwrap(); + let specular_constant = self["specular_constant"].as_f32().unwrap(); + let specular_exponent = self["specular_exponent"].as_f32().unwrap(); + let kernel_unit_length_x = self["kernel_unit_length_x"].as_f32().unwrap(); + let kernel_unit_length_y = self["kernel_unit_length_y"].as_f32().unwrap(); + let azimuth = self["azimuth"].as_f32().unwrap(); + let elevation = self["elevation"].as_f32().unwrap(); + Some(FilterOp::SVGFESpecularLightingDistant{ + node, surface_scale, specular_constant, + specular_exponent, kernel_unit_length_x, + kernel_unit_length_y, azimuth, elevation}) + }, + "specularlightingpoint" => { + let surface_scale = self["surface_scale"].as_f32().unwrap(); + let specular_constant = self["specular_constant"].as_f32().unwrap(); + let specular_exponent = self["specular_exponent"].as_f32().unwrap(); + let kernel_unit_length_x = self["kernel_unit_length_x"].as_f32().unwrap(); + let kernel_unit_length_y = self["kernel_unit_length_y"].as_f32().unwrap(); + let x = self["x"].as_f32().unwrap(); + let y = self["y"].as_f32().unwrap(); + let z = self["z"].as_f32().unwrap(); + Some(FilterOp::SVGFESpecularLightingPoint{ + node, surface_scale, specular_constant, + specular_exponent, kernel_unit_length_x, + kernel_unit_length_y, x, y, z}) + }, + "specularlightingspot" => { + let surface_scale = self["surface_scale"].as_f32().unwrap(); + let specular_constant = self["specular_constant"].as_f32().unwrap(); + let specular_exponent = self["specular_exponent"].as_f32().unwrap(); + let kernel_unit_length_x = self["kernel_unit_length_x"].as_f32().unwrap(); + let kernel_unit_length_y = self["kernel_unit_length_y"].as_f32().unwrap(); + let x = self["x"].as_f32().unwrap(); + let y = self["y"].as_f32().unwrap(); + let z = self["z"].as_f32().unwrap(); + let points_at_x = self["points_at_x"].as_f32().unwrap(); + let points_at_y = self["points_at_y"].as_f32().unwrap(); + let points_at_z = self["points_at_z"].as_f32().unwrap(); + let cone_exponent = self["cone_exponent"].as_f32().unwrap(); + let limiting_cone_angle = self["limiting_cone_angle"].as_f32().unwrap(); + Some(FilterOp::SVGFESpecularLightingSpot{ + node, surface_scale, specular_constant, + specular_exponent, kernel_unit_length_x, + kernel_unit_length_y, x, y, z, points_at_x, + points_at_y, points_at_z, limiting_cone_angle, + cone_exponent}) + }, + "tile" => Some(FilterOp::SVGFETile{node}), + "turbulencewithfractalnoisewithnostitching" => { + let base_frequency_x = self["base_frequency_x"].as_f32().unwrap(); + let base_frequency_y = self["base_frequency_y"].as_f32().unwrap(); + let num_octaves = self["num_octaves"].as_i64().unwrap() as u32; + let seed = self["seed"].as_i64().unwrap() as u32; + Some(FilterOp::SVGFETurbulenceWithFractalNoiseWithNoStitching{ + node, base_frequency_x, base_frequency_y, num_octaves, seed}) + }, + "turbulencewithfractalnoisewithstitching" => { + let base_frequency_x = self["base_frequency_x"].as_f32().unwrap(); + let base_frequency_y = self["base_frequency_y"].as_f32().unwrap(); + let num_octaves = self["num_octaves"].as_i64().unwrap() as u32; + let seed = self["seed"].as_i64().unwrap() as u32; + Some(FilterOp::SVGFETurbulenceWithFractalNoiseWithStitching{ + node, base_frequency_x, base_frequency_y, num_octaves, seed}) + }, + "turbulencewithturbulencenoisewithnostitching" => { + let base_frequency_x = self["base_frequency_x"].as_f32().unwrap(); + let base_frequency_y = self["base_frequency_y"].as_f32().unwrap(); + let num_octaves = self["num_octaves"].as_i64().unwrap() as u32; + let seed = self["seed"].as_i64().unwrap() as u32; + Some(FilterOp::SVGFETurbulenceWithTurbulenceNoiseWithNoStitching{ + node, base_frequency_x, base_frequency_y, num_octaves, seed}) + }, + "turbulencewithturbulencenoisewithstitching" => { + let base_frequency_x = self["base_frequency_x"].as_f32().unwrap(); + let base_frequency_y = self["base_frequency_y"].as_f32().unwrap(); + let num_octaves = self["num_octaves"].as_i64().unwrap() as u32; + let seed = self["seed"].as_i64().unwrap() as u32; + Some(FilterOp::SVGFETurbulenceWithTurbulenceNoiseWithStitching{ + node, base_frequency_x, base_frequency_y, num_octaves, seed}) + }, + _ => None, + } + } if let Some(s) = self.as_str() { match parse_function(s) { ("identity", _, _) => { |