Update build result flags (unsupported feature flags) in the SVG backend
This commit is contained in:
parent
d9a93a102c
commit
d8875efd61
|
@ -44,21 +44,18 @@ bitflags! {
|
||||||
// NB: If you change this, make sure to update the `Display`
|
// NB: If you change this, make sure to update the `Display`
|
||||||
// implementation as well.
|
// implementation as well.
|
||||||
pub struct BuildResultFlags: u16 {
|
pub struct BuildResultFlags: u16 {
|
||||||
const UNSUPPORTED_CLIP_PATH_NODE = 0x0001;
|
const UNSUPPORTED_FILTER_NODE = 0x0001;
|
||||||
const UNSUPPORTED_DEFS_NODE = 0x0002;
|
const UNSUPPORTED_IMAGE_NODE = 0x0002;
|
||||||
const UNSUPPORTED_FILTER_NODE = 0x0004;
|
const UNSUPPORTED_LINEAR_GRADIENT_NODE = 0x0004;
|
||||||
const UNSUPPORTED_IMAGE_NODE = 0x0008;
|
const UNSUPPORTED_MASK_NODE = 0x0008;
|
||||||
const UNSUPPORTED_LINEAR_GRADIENT_NODE = 0x0010;
|
const UNSUPPORTED_PATTERN_NODE = 0x0010;
|
||||||
const UNSUPPORTED_MASK_NODE = 0x0020;
|
const UNSUPPORTED_RADIAL_GRADIENT_NODE = 0x0020;
|
||||||
const UNSUPPORTED_PATTERN_NODE = 0x0040;
|
const UNSUPPORTED_NESTED_SVG_NODE = 0x0040;
|
||||||
const UNSUPPORTED_RADIAL_GRADIENT_NODE = 0x0080;
|
const UNSUPPORTED_MULTIPLE_CLIP_PATHS = 0x0080;
|
||||||
const UNSUPPORTED_NESTED_SVG_NODE = 0x0100;
|
const UNSUPPORTED_LINK_PAINT = 0x0100;
|
||||||
const UNSUPPORTED_TEXT_NODE = 0x0200;
|
const UNSUPPORTED_FILTER_ATTR = 0x0200;
|
||||||
const UNSUPPORTED_LINK_PAINT = 0x0400;
|
const UNSUPPORTED_MASK_ATTR = 0x0400;
|
||||||
const UNSUPPORTED_CLIP_PATH_ATTR = 0x0800;
|
const UNSUPPORTED_STROKE_DASH = 0x0800;
|
||||||
const UNSUPPORTED_FILTER_ATTR = 0x1000;
|
|
||||||
const UNSUPPORTED_MASK_ATTR = 0x2000;
|
|
||||||
const UNSUPPORTED_OPACITY_ATTR = 0x4000;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,17 +101,19 @@ impl BuiltSVG {
|
||||||
match *node.borrow() {
|
match *node.borrow() {
|
||||||
NodeKind::Group(ref group) => {
|
NodeKind::Group(ref group) => {
|
||||||
if group.filter.is_some() {
|
if group.filter.is_some() {
|
||||||
self.result_flags
|
self.result_flags.insert(BuildResultFlags::UNSUPPORTED_FILTER_ATTR);
|
||||||
.insert(BuildResultFlags::UNSUPPORTED_FILTER_ATTR);
|
|
||||||
}
|
}
|
||||||
if group.mask.is_some() {
|
if group.mask.is_some() {
|
||||||
self.result_flags
|
self.result_flags.insert(BuildResultFlags::UNSUPPORTED_MASK_ATTR);
|
||||||
.insert(BuildResultFlags::UNSUPPORTED_MASK_ATTR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(ref clip_path_name) = group.clip_path {
|
if let Some(ref clip_path_name) = group.clip_path {
|
||||||
if let Some(clip_path_id) = self.clip_paths.get(clip_path_name) {
|
if let Some(clip_path_id) = self.clip_paths.get(clip_path_name) {
|
||||||
// TODO(pcwalton): Combine multiple clip paths if there's already one.
|
// TODO(pcwalton): Combine multiple clip paths if there's already one.
|
||||||
|
if state.clip_path.is_some() {
|
||||||
|
self.result_flags
|
||||||
|
.insert(BuildResultFlags::UNSUPPORTED_MULTIPLE_CLIP_PATHS);
|
||||||
|
}
|
||||||
state.clip_path = Some(*clip_path_id);
|
state.clip_path = Some(*clip_path_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,6 +126,9 @@ impl BuiltSVG {
|
||||||
// TODO(pcwalton): Multiple clip paths.
|
// TODO(pcwalton): Multiple clip paths.
|
||||||
let path = UsvgPathToSegments::new(path.data.iter().cloned());
|
let path = UsvgPathToSegments::new(path.data.iter().cloned());
|
||||||
let path = Transform2FPathIter::new(path, &state.transform);
|
let path = Transform2FPathIter::new(path, &state.transform);
|
||||||
|
if clip_outline.is_some() {
|
||||||
|
self.result_flags.insert(BuildResultFlags::UNSUPPORTED_MULTIPLE_CLIP_PATHS);
|
||||||
|
}
|
||||||
*clip_outline = Some(Outline::from_segments(path));
|
*clip_outline = Some(Outline::from_segments(path));
|
||||||
}
|
}
|
||||||
NodeKind::Path(ref path) if state.path_destination == PathDestination::Draw &&
|
NodeKind::Path(ref path) if state.path_destination == PathDestination::Draw &&
|
||||||
|
@ -152,6 +154,10 @@ impl BuiltSVG {
|
||||||
stroke.miterlimit.value() as f32),
|
stroke.miterlimit.value() as f32),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if stroke.dasharray.is_some() {
|
||||||
|
self.result_flags.insert(BuildResultFlags::UNSUPPORTED_STROKE_DASH);
|
||||||
|
}
|
||||||
|
|
||||||
let path = UsvgPathToSegments::new(path.data.iter().cloned());
|
let path = UsvgPathToSegments::new(path.data.iter().cloned());
|
||||||
let outline = Outline::from_segments(path);
|
let outline = Outline::from_segments(path);
|
||||||
|
|
||||||
|
@ -267,8 +273,6 @@ impl Display for BuildResultFlags {
|
||||||
|
|
||||||
// Must match the order in `BuildResultFlags`.
|
// Must match the order in `BuildResultFlags`.
|
||||||
static NAMES: &'static [&'static str] = &[
|
static NAMES: &'static [&'static str] = &[
|
||||||
"<clipPath>",
|
|
||||||
"<defs>",
|
|
||||||
"<filter>",
|
"<filter>",
|
||||||
"<image>",
|
"<image>",
|
||||||
"<linearGradient>",
|
"<linearGradient>",
|
||||||
|
@ -276,12 +280,11 @@ impl Display for BuildResultFlags {
|
||||||
"<pattern>",
|
"<pattern>",
|
||||||
"<radialGradient>",
|
"<radialGradient>",
|
||||||
"nested <svg>",
|
"nested <svg>",
|
||||||
"<text>",
|
"multiple clip paths",
|
||||||
"paint server element",
|
"non-color paint",
|
||||||
"clip-path attribute",
|
|
||||||
"filter attribute",
|
"filter attribute",
|
||||||
"mask attribute",
|
"mask attribute",
|
||||||
"opacity attribute",
|
"stroke dash",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue