diff options
Diffstat (limited to 'gfx/wr/webrender/src/pattern.rs')
-rw-r--r-- | gfx/wr/webrender/src/pattern.rs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/gfx/wr/webrender/src/pattern.rs b/gfx/wr/webrender/src/pattern.rs index 36a06fa2b9..f4ddd51f9f 100644 --- a/gfx/wr/webrender/src/pattern.rs +++ b/gfx/wr/webrender/src/pattern.rs @@ -10,12 +10,14 @@ use api::{ColorF, PremultipliedColorF}; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub enum PatternKind { ColorOrTexture = 0, + RadialGradient = 1, + ConicGradient = 2, - Mask = 1, + Mask = 3, // When adding patterns, don't forget to update the NUM_PATTERNS constant. } -pub const NUM_PATTERNS: u32 = 2; +pub const NUM_PATTERNS: u32 = 4; impl PatternKind { pub fn from_u32(val: u32) -> Self { @@ -61,8 +63,21 @@ impl Pattern { Pattern { kind: PatternKind::ColorOrTexture, shader_input: PatternShaderInput::default(), - base_color: PremultipliedColorF::BLACK, + base_color: PremultipliedColorF::WHITE, is_opaque: false, } } + + pub fn supports_segmented_rendering(&self) -> bool { + match self.kind { + PatternKind::ColorOrTexture | PatternKind::Mask => { + true + } + PatternKind::RadialGradient | PatternKind::ConicGradient => { + // TODO: We need to fix up the layout coords mismatch in pattern + // and quad rendering to allow these to be segmented. + false + } + } + } } |