mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Add get_zero_value for IntermediateSVGPaint.
This commit is contained in:
parent
efed75ae5a
commit
c89c938623
1 changed files with 21 additions and 1 deletions
|
@ -2765,7 +2765,7 @@ impl Animatable for IntermediateRGBA {
|
|||
|
||||
#[inline]
|
||||
fn get_zero_value(&self) -> Option<Self> {
|
||||
Some(IntermediateRGBA::new(0., 0., 0., 1.))
|
||||
Some(IntermediateRGBA::transparent())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -2982,6 +2982,14 @@ impl Animatable for IntermediateSVGPaint {
|
|||
Ok(self.kind.compute_squared_distance(&other.kind)? +
|
||||
self.fallback.compute_squared_distance(&other.fallback)?)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_zero_value(&self) -> Option<Self> {
|
||||
Some(IntermediateSVGPaint {
|
||||
kind: option_try!(self.kind.get_zero_value()),
|
||||
fallback: self.fallback.and_then(|v| v.get_zero_value()),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Animatable for IntermediateSVGPaintKind {
|
||||
|
@ -3012,6 +3020,18 @@ impl Animatable for IntermediateSVGPaintKind {
|
|||
_ => Err(())
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_zero_value(&self) -> Option<Self> {
|
||||
match self {
|
||||
&SVGPaintKind::Color(ref color) => color.get_zero_value()
|
||||
.map(SVGPaintKind::Color),
|
||||
&SVGPaintKind::None |
|
||||
&SVGPaintKind::ContextFill |
|
||||
&SVGPaintKind::ContextStroke => Some(self.clone()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue