Implement Pattern::is_zero_size_gradient

There are probably other times where this would be true but I'll worry
about that later
This commit is contained in:
Bastien Orivel 2019-08-08 16:22:40 +02:00
parent 93f1053b0e
commit 0a878da500

View file

@ -91,8 +91,17 @@ impl<'a> CanvasPaintState<'a> {
impl Pattern<'_> {
pub fn is_zero_size_gradient(&self) -> bool {
match *self {
Pattern::Raqote(_) => unimplemented!(),
match self {
Pattern::Raqote(p) => {
use raqote::Source::*;
match p {
LinearGradient(g, ..) | RadialGradient(g, ..) | TwoCircleRadialGradient(g, ..) => {
g.stops.is_empty()
},
_ => false
}
},
}
}
pub fn as_raqote(&self) -> &raqote::Source {