From a90a5cba08fdf6c0ceb95101c275108a152a3aed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:37 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- gfx/wr/webrender_api/src/display_item.rs | 478 ++++++++++++++++++++++++++++++- gfx/wr/webrender_api/src/display_list.rs | 4 + 2 files changed, 479 insertions(+), 3 deletions(-) (limited to 'gfx/wr/webrender_api') diff --git a/gfx/wr/webrender_api/src/display_item.rs b/gfx/wr/webrender_api/src/display_item.rs index 190d36ccba..34d5b9627a 100644 --- a/gfx/wr/webrender_api/src/display_item.rs +++ b/gfx/wr/webrender_api/src/display_item.rs @@ -8,6 +8,7 @@ use std::ops::Not; // local imports use crate::font; use crate::{APZScrollGeneration, HasScrollLinkedEffect, PipelineId, PropertyBinding}; +use crate::serde::{Serialize, Deserialize}; use crate::color::ColorF; use crate::image::{ColorDepth, ImageKey}; use crate::units::*; @@ -323,6 +324,9 @@ pub struct StickyFrameDescriptor { /// A unique (per-pipeline) key for this spatial that is stable across display lists. pub key: SpatialTreeItemKey, + + /// A property binding that we use to store an animation ID for APZ + pub transform: Option>, } #[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] @@ -1203,28 +1207,495 @@ impl FilterPrimitive { } } -/// CSS filter. #[repr(C)] -#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize, PeekPoke)] +#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize, PeekPoke)] +pub enum FilterOpGraphPictureBufferId { + #[default] + /// empty slot in feMerge inputs + None, + /// reference to another (earlier) node in filter graph + BufferId(i16), +} + +#[repr(C)] +#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, PeekPoke)] +pub struct FilterOpGraphPictureReference { + /// Id of the picture in question in a namespace unique to this filter DAG + pub buffer_id: FilterOpGraphPictureBufferId, +} + +#[repr(C)] +#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, PeekPoke)] +pub struct FilterOpGraphNode { + /// True if color_interpolation_filter == LinearRgb; shader will convert + /// sRGB texture pixel colors on load and convert back on store, for correct + /// interpolation + pub linear: bool, + /// virtualized picture input binding 1 (i.e. texture source), typically + /// this is used, but certain filters do not use it + pub input: FilterOpGraphPictureReference, + /// virtualized picture input binding 2 (i.e. texture sources), only certain + /// filters use this + pub input2: FilterOpGraphPictureReference, + /// rect this node will render into, in filter space + pub subregion: LayoutRect, +} + +#[repr(C)] +#[derive(Clone, Copy, Debug, Deserialize, Serialize, PeekPoke)] pub enum FilterOp { /// Filter that does no transformation of the colors, needed for - /// debug purposes only. + /// debug purposes, and is the default value in impl_default_for_enums. + /// parameters: none + /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear) Identity, + /// apply blur effect + /// parameters: stdDeviationX, stdDeviationY + /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear) Blur(f32, f32), + /// apply brightness effect + /// parameters: amount + /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear) Brightness(f32), + /// apply contrast effect + /// parameters: amount + /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear) Contrast(f32), + /// fade image toward greyscale version of image + /// parameters: amount + /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear) Grayscale(f32), + /// fade image toward hue-rotated version of image (rotate RGB around color wheel) + /// parameters: angle + /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear) HueRotate(f32), + /// fade image toward inverted image (1 - RGB) + /// parameters: amount + /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear) Invert(f32), + /// multiplies color and alpha by opacity + /// parameters: amount + /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear) Opacity(PropertyBinding, f32), + /// multiply saturation of colors + /// parameters: amount + /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear) Saturate(f32), + /// fade image toward sepia tone version of image + /// parameters: amount + /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear) Sepia(f32), + /// add drop shadow version of image to the image + /// parameters: shadow + /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear) DropShadow(Shadow), + /// transform color and alpha in image through 4x5 color matrix (transposed for efficiency) + /// parameters: matrix[5][4] + /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear) ColorMatrix([f32; 20]), + /// internal use - convert sRGB input to linear output + /// parameters: none + /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear) SrgbToLinear, + /// internal use - convert linear input to sRGB output + /// parameters: none + /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear) LinearToSrgb, + /// remap RGBA with color gradients and component swizzle + /// parameters: FilterData + /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear) ComponentTransfer, + /// replace image with a solid color + /// NOTE: UNUSED; Gecko never produces this filter + /// parameters: color + /// CSS filter semantics - operates on previous picture,uses sRGB space (non-linear) Flood(ColorF), + /// Filter that copies the SourceGraphic image into the specified subregion, + /// This is intentionally the only way to get SourceGraphic into the graph, + /// as the filter region must be applied before it is used. + /// parameters: FilterOpGraphNode + /// SVG filter semantics - no inputs, no linear + SVGFESourceGraphic{node: FilterOpGraphNode}, + /// Filter that copies the SourceAlpha image into the specified subregion, + /// This is intentionally the only way to get SourceGraphic into the graph, + /// as the filter region must be applied before it is used. + /// parameters: FilterOpGraphNode + /// SVG filter semantics - no inputs, no linear + SVGFESourceAlpha{node: FilterOpGraphNode}, + /// Filter that does no transformation of the colors, used for subregion + /// cropping only. + SVGFEIdentity{node: FilterOpGraphNode}, + /// represents CSS opacity property as a graph node like the rest of the SVGFE* filters + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + SVGFEOpacity{node: FilterOpGraphNode, valuebinding: PropertyBinding, value: f32}, + /// convert a color image to an alpha channel - internal use; generated by + /// SVGFilterInstance::GetOrCreateSourceAlphaIndex(). + SVGFEToAlpha{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_DARKEN + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feBlendElement + SVGFEBlendDarken{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_LIGHTEN + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feBlendElement + SVGFEBlendLighten{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_MULTIPLY + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feBlendElement + SVGFEBlendMultiply{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_NORMAL + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feBlendElement + SVGFEBlendNormal{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_SCREEN + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feBlendElement + SVGFEBlendScreen{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_OVERLAY + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode + SVGFEBlendOverlay{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_COLOR_DODGE + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode + SVGFEBlendColorDodge{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_COLOR_BURN + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode + SVGFEBlendColorBurn{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_HARD_LIGHT + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode + SVGFEBlendHardLight{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_SOFT_LIGHT + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode + SVGFEBlendSoftLight{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_DIFFERENCE + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode + SVGFEBlendDifference{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_EXCLUSION + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode + SVGFEBlendExclusion{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_HUE + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode + SVGFEBlendHue{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_SATURATION + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode + SVGFEBlendSaturation{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_COLOR + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode + SVGFEBlendColor{node: FilterOpGraphNode}, + /// combine 2 images with SVG_FEBLEND_MODE_LUMINOSITY + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode + SVGFEBlendLuminosity{node: FilterOpGraphNode}, + /// transform colors of image through 5x4 color matrix (transposed for efficiency) + /// parameters: FilterOpGraphNode, matrix[5][4] + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feColorMatrixElement + SVGFEColorMatrix{node: FilterOpGraphNode, values: [f32; 20]}, + /// transform colors of image through configurable gradients with component swizzle + /// parameters: FilterOpGraphNode, FilterData + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feComponentTransferElement + SVGFEComponentTransfer{node: FilterOpGraphNode}, + /// composite 2 images with chosen composite mode with parameters for that mode + /// parameters: FilterOpGraphNode, k1, k2, k3, k4 + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feCompositeElement + SVGFECompositeArithmetic{node: FilterOpGraphNode, k1: f32, k2: f32, k3: f32, + k4: f32}, + /// composite 2 images with chosen composite mode with parameters for that mode + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feCompositeElement + SVGFECompositeATop{node: FilterOpGraphNode}, + /// composite 2 images with chosen composite mode with parameters for that mode + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feCompositeElement + SVGFECompositeIn{node: FilterOpGraphNode}, + /// composite 2 images with chosen composite mode with parameters for that mode + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Docs: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feComposite + SVGFECompositeLighter{node: FilterOpGraphNode}, + /// composite 2 images with chosen composite mode with parameters for that mode + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feCompositeElement + SVGFECompositeOut{node: FilterOpGraphNode}, + /// composite 2 images with chosen composite mode with parameters for that mode + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feCompositeElement + SVGFECompositeOver{node: FilterOpGraphNode}, + /// composite 2 images with chosen composite mode with parameters for that mode + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feCompositeElement + SVGFECompositeXOR{node: FilterOpGraphNode}, + /// transform image through convolution matrix of up to 25 values (spec + /// allows more but for performance reasons we do not) + /// parameters: FilterOpGraphNode, orderX, orderY, kernelValues[25], + /// divisor, bias, targetX, targetY, kernelUnitLengthX, kernelUnitLengthY, + /// preserveAlpha + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feConvolveMatrixElement + SVGFEConvolveMatrixEdgeModeDuplicate{node: FilterOpGraphNode, order_x: i32, + order_y: i32, kernel: [f32; 25], divisor: f32, bias: f32, target_x: i32, + target_y: i32, kernel_unit_length_x: f32, kernel_unit_length_y: f32, + preserve_alpha: i32}, + /// transform image through convolution matrix of up to 25 values (spec + /// allows more but for performance reasons we do not) + /// parameters: FilterOpGraphNode, orderX, orderY, kernelValues[25], + /// divisor, bias, targetX, targetY, kernelUnitLengthX, kernelUnitLengthY, + /// preserveAlpha + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feConvolveMatrixElement + SVGFEConvolveMatrixEdgeModeNone{node: FilterOpGraphNode, order_x: i32, + order_y: i32, kernel: [f32; 25], divisor: f32, bias: f32, target_x: i32, + target_y: i32, kernel_unit_length_x: f32, kernel_unit_length_y: f32, + preserve_alpha: i32}, + /// transform image through convolution matrix of up to 25 values (spec + /// allows more but for performance reasons we do not) + /// parameters: FilterOpGraphNode, orderX, orderY, kernelValues[25], + /// divisor, bias, targetX, targetY, kernelUnitLengthX, kernelUnitLengthY, + /// preserveAlpha + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#feConvolveMatrixElement + SVGFEConvolveMatrixEdgeModeWrap{node: FilterOpGraphNode, order_x: i32, + order_y: i32, kernel: [f32; 25], divisor: f32, bias: f32, target_x: i32, + target_y: i32, kernel_unit_length_x: f32, kernel_unit_length_y: f32, + preserve_alpha: i32}, + /// calculate lighting based on heightmap image with provided values for a + /// distant light source with specified direction + /// parameters: FilterOpGraphNode, surfaceScale, diffuseConstant, + /// kernelUnitLengthX, kernelUnitLengthY, azimuth, elevation + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEDiffuseLightingElement + /// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEDistantLightElement + SVGFEDiffuseLightingDistant{node: FilterOpGraphNode, surface_scale: f32, + diffuse_constant: f32, kernel_unit_length_x: f32, + kernel_unit_length_y: f32, azimuth: f32, elevation: f32}, + /// calculate lighting based on heightmap image with provided values for a + /// point light source at specified location + /// parameters: FilterOpGraphNode, surfaceScale, diffuseConstant, + /// kernelUnitLengthX, kernelUnitLengthY, x, y, z + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEDiffuseLightingElement + /// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEPointLightElement + SVGFEDiffuseLightingPoint{node: FilterOpGraphNode, surface_scale: f32, + diffuse_constant: f32, kernel_unit_length_x: f32, + kernel_unit_length_y: f32, x: f32, y: f32, z: f32}, + /// calculate lighting based on heightmap image with provided values for a + /// spot light source at specified location pointing at specified target + /// location with specified hotspot sharpness and cone angle + /// parameters: FilterOpGraphNode, surfaceScale, diffuseConstant, + /// kernelUnitLengthX, kernelUnitLengthY, x, y, z, pointsAtX, pointsAtY, + /// pointsAtZ, specularExponent, limitingConeAngle + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEDiffuseLightingElement + /// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFESpotLightElement + SVGFEDiffuseLightingSpot{node: FilterOpGraphNode, surface_scale: f32, + diffuse_constant: f32, kernel_unit_length_x: f32, + kernel_unit_length_y: f32, x: f32, y: f32, z: f32, points_at_x: f32, + points_at_y: f32, points_at_z: f32, cone_exponent: f32, + limiting_cone_angle: f32}, + /// calculate a distorted version of first input image using offset values + /// from second input image at specified intensity + /// parameters: FilterOpGraphNode, scale, xChannelSelector, yChannelSelector + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEDisplacementMapElement + SVGFEDisplacementMap{node: FilterOpGraphNode, scale: f32, + x_channel_selector: u32, y_channel_selector: u32}, + /// create and merge a dropshadow version of the specified image's alpha + /// channel with specified offset and blur radius + /// parameters: FilterOpGraphNode, flood_color, flood_opacity, dx, dy, + /// stdDeviationX, stdDeviationY + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEDropShadowElement + SVGFEDropShadow{node: FilterOpGraphNode, color: ColorF, dx: f32, dy: f32, + std_deviation_x: f32, std_deviation_y: f32}, + /// synthesize a new image of specified size containing a solid color + /// parameters: FilterOpGraphNode, color + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEFloodElement + SVGFEFlood{node: FilterOpGraphNode, color: ColorF}, + /// create a blurred version of the input image + /// parameters: FilterOpGraphNode, stdDeviationX, stdDeviationY + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEGaussianBlurElement + SVGFEGaussianBlur{node: FilterOpGraphNode, std_deviation_x: f32, std_deviation_y: f32}, + /// synthesize a new image based on a url (i.e. blob image source) + /// parameters: FilterOpGraphNode, sampling_filter (see SamplingFilter in Types.h), transform + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEImageElement + SVGFEImage{node: FilterOpGraphNode, sampling_filter: u32, matrix: [f32; 6]}, + /// create a new image based on the input image with the contour stretched + /// outward (dilate operator) + /// parameters: FilterOpGraphNode, radiusX, radiusY + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEMorphologyElement + SVGFEMorphologyDilate{node: FilterOpGraphNode, radius_x: f32, radius_y: f32}, + /// create a new image based on the input image with the contour shrunken + /// inward (erode operator) + /// parameters: FilterOpGraphNode, radiusX, radiusY + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEMorphologyElement + SVGFEMorphologyErode{node: FilterOpGraphNode, radius_x: f32, radius_y: f32}, + /// create a new image that is a scrolled version of the input image, this + /// is basically a no-op as we support offset in the graph node + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEOffsetElement + SVGFEOffset{node: FilterOpGraphNode, offset_x: f32, offset_y: f32}, + /// calculate lighting based on heightmap image with provided values for a + /// distant light source with specified direction + /// parameters: FilerData, surfaceScale, specularConstant, specularExponent, + /// kernelUnitLengthX, kernelUnitLengthY, azimuth, elevation + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFESpecularLightingElement + /// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEDistantLightElement + SVGFESpecularLightingDistant{node: FilterOpGraphNode, surface_scale: f32, + specular_constant: f32, specular_exponent: f32, + kernel_unit_length_x: f32, kernel_unit_length_y: f32, azimuth: f32, + elevation: f32}, + /// calculate lighting based on heightmap image with provided values for a + /// point light source at specified location + /// parameters: FilterOpGraphNode, surfaceScale, specularConstant, + /// specularExponent, kernelUnitLengthX, kernelUnitLengthY, x, y, z + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFESpecularLightingElement + /// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEPointLightElement + SVGFESpecularLightingPoint{node: FilterOpGraphNode, surface_scale: f32, + specular_constant: f32, specular_exponent: f32, + kernel_unit_length_x: f32, kernel_unit_length_y: f32, x: f32, y: f32, + z: f32}, + /// calculate lighting based on heightmap image with provided values for a + /// spot light source at specified location pointing at specified target + /// location with specified hotspot sharpness and cone angle + /// parameters: FilterOpGraphNode, surfaceScale, specularConstant, + /// specularExponent, kernelUnitLengthX, kernelUnitLengthY, x, y, z, + /// pointsAtX, pointsAtY, pointsAtZ, specularExponent, limitingConeAngle + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFESpecularLightingElement + /// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFESpotLightElement + SVGFESpecularLightingSpot{node: FilterOpGraphNode, surface_scale: f32, + specular_constant: f32, specular_exponent: f32, + kernel_unit_length_x: f32, kernel_unit_length_y: f32, x: f32, y: f32, + z: f32, points_at_x: f32, points_at_y: f32, points_at_z: f32, + cone_exponent: f32, limiting_cone_angle: f32}, + /// create a new image based on the input image, repeated throughout the + /// output rectangle + /// parameters: FilterOpGraphNode + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFETileElement + SVGFETile{node: FilterOpGraphNode}, + /// synthesize a new image based on Fractal Noise (Perlin) with the chosen + /// stitching mode + /// parameters: FilterOpGraphNode, baseFrequencyX, baseFrequencyY, + /// numOctaves, seed + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFETurbulenceElement + SVGFETurbulenceWithFractalNoiseWithNoStitching{node: FilterOpGraphNode, + base_frequency_x: f32, base_frequency_y: f32, num_octaves: u32, + seed: u32}, + /// synthesize a new image based on Fractal Noise (Perlin) with the chosen + /// stitching mode + /// parameters: FilterOpGraphNode, baseFrequencyX, baseFrequencyY, + /// numOctaves, seed + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFETurbulenceElement + SVGFETurbulenceWithFractalNoiseWithStitching{node: FilterOpGraphNode, + base_frequency_x: f32, base_frequency_y: f32, num_octaves: u32, + seed: u32}, + /// synthesize a new image based on Turbulence Noise (offset vectors) + /// parameters: FilterOpGraphNode, baseFrequencyX, baseFrequencyY, + /// numOctaves, seed + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFETurbulenceElement + SVGFETurbulenceWithTurbulenceNoiseWithNoStitching{node: FilterOpGraphNode, + base_frequency_x: f32, base_frequency_y: f32, num_octaves: u32, + seed: u32}, + /// synthesize a new image based on Turbulence Noise (offset vectors) + /// parameters: FilterOpGraphNode, baseFrequencyX, baseFrequencyY, + /// numOctaves, seed + /// SVG filter semantics - selectable input(s), selectable between linear + /// (default) and sRGB color space for calculations + /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFETurbulenceElement + SVGFETurbulenceWithTurbulenceNoiseWithStitching{node: FilterOpGraphNode, + base_frequency_x: f32, base_frequency_y: f32, num_octaves: u32, seed: u32}, } #[repr(u8)] @@ -1239,6 +1710,7 @@ pub enum ComponentTransferFuncType { #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] pub struct FilterData { + /// ComponentTransfer / SVGFEComponentTransfer pub func_r_type: ComponentTransferFuncType, pub r_values: Vec, pub func_g_type: ComponentTransferFuncType, diff --git a/gfx/wr/webrender_api/src/display_list.rs b/gfx/wr/webrender_api/src/display_list.rs index f1eea85ca3..e85f816214 100644 --- a/gfx/wr/webrender_api/src/display_list.rs +++ b/gfx/wr/webrender_api/src/display_list.rs @@ -2040,6 +2040,9 @@ impl DisplayListBuilder { horizontal_offset_bounds: di::StickyOffsetBounds, previously_applied_offset: LayoutVector2D, key: di::SpatialTreeItemKey, + // TODO: The caller only ever passes an identity transform. + // Could we pass just an (optional) animation id instead? + transform: Option> ) -> di::SpatialId { let id = self.generate_spatial_index(); let current_offset = self.current_offset(parent_spatial_id); @@ -2059,6 +2062,7 @@ impl DisplayListBuilder { horizontal_offset_bounds, previously_applied_offset, key, + transform, }); self.push_spatial_tree_item(&descriptor); -- cgit v1.2.3