From 0a878da500d1027ffc6f70e0b20c373b6c4e3765 Mon Sep 17 00:00:00 2001 From: Bastien Orivel Date: Thu, 8 Aug 2019 16:22:40 +0200 Subject: [PATCH] Implement Pattern::is_zero_size_gradient There are probably other times where this would be true but I'll worry about that later --- components/canvas/raqote_backend.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/components/canvas/raqote_backend.rs b/components/canvas/raqote_backend.rs index 18244d5c51c..e301e31562f 100644 --- a/components/canvas/raqote_backend.rs +++ b/components/canvas/raqote_backend.rs @@ -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 {