summaryrefslogtreecommitdiffstats
path: root/gfx/wr/webrender/src/pattern.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
commit59203c63bb777a3bacec32fb8830fba33540e809 (patch)
tree58298e711c0ff0575818c30485b44a2f21bf28a0 /gfx/wr/webrender/src/pattern.rs
parentAdding upstream version 126.0.1. (diff)
downloadfirefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz
firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/wr/webrender/src/pattern.rs')
-rw-r--r--gfx/wr/webrender/src/pattern.rs21
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
+ }
+ }
+ }
}