mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Bug 1776621 - Remove per-item complex clips in wrench in favor of explicit clip-chains r=gfx-reviewers,lsalzman
A step towards removing specification of clips via old ClipId style in wrench. Differential Revision: https://phabricator.services.mozilla.com/D150344
This commit is contained in:
parent
26ac926331
commit
0c7933b0a3
@ -1,63 +1,110 @@
|
||||
---
|
||||
root:
|
||||
items:
|
||||
- type: clip
|
||||
id: 100
|
||||
complex:
|
||||
- rect: [20, 20, 100, 100]
|
||||
radius: [32, 16]
|
||||
- type: clip-chain
|
||||
id: 200
|
||||
clips: [100]
|
||||
- type: rect
|
||||
bounds: [20, 20, 100, 100]
|
||||
color: red
|
||||
complex-clip:
|
||||
rect: [20, 20, 100, 100]
|
||||
radius: [32, 16]
|
||||
clip-chain: 200
|
||||
|
||||
- type: clip
|
||||
id: 101
|
||||
complex:
|
||||
- rect: [130, 20, 100, 100]
|
||||
radius: [32, 16]
|
||||
clip-mode: clip-out
|
||||
- type: clip-chain
|
||||
id: 201
|
||||
clips: [101]
|
||||
- type: rect
|
||||
bounds: [130, 20, 100, 100]
|
||||
color: green
|
||||
complex-clip:
|
||||
rect: [130, 20, 100, 100]
|
||||
radius: [32, 16]
|
||||
clip-mode: clip-out
|
||||
clip-chain: 201
|
||||
|
||||
- type: clip
|
||||
id: 102
|
||||
complex:
|
||||
- rect: [20, 130, 100, 100]
|
||||
radius: [16, 32]
|
||||
- type: clip-chain
|
||||
id: 202
|
||||
clips: [102]
|
||||
- type: rect
|
||||
bounds: [20, 130, 100, 100]
|
||||
color: red
|
||||
complex-clip:
|
||||
rect: [20, 130, 100, 100]
|
||||
radius: [16, 32]
|
||||
clip-chain: 202
|
||||
|
||||
- type: clip
|
||||
id: 103
|
||||
complex:
|
||||
- rect: [130, 130, 100, 100]
|
||||
radius: [16, 32]
|
||||
clip-mode: clip-out
|
||||
- type: clip-chain
|
||||
id: 203
|
||||
clips: [103]
|
||||
- type: rect
|
||||
bounds: [130, 130, 100, 100]
|
||||
color: green
|
||||
complex-clip:
|
||||
rect: [130, 130, 100, 100]
|
||||
radius: [16, 32]
|
||||
clip-mode: clip-out
|
||||
clip-chain: 203
|
||||
|
||||
- type: clip
|
||||
id: 104
|
||||
complex:
|
||||
- rect: [20, 240, 100, 100]
|
||||
radius: [128, 32]
|
||||
- type: clip-chain
|
||||
id: 204
|
||||
clips: [104]
|
||||
- type: rect
|
||||
bounds: [20, 240, 100, 100]
|
||||
color: red
|
||||
complex-clip:
|
||||
rect: [20, 240, 100, 100]
|
||||
radius: [128, 32]
|
||||
clip-chain: 204
|
||||
|
||||
- type: clip
|
||||
id: 105
|
||||
complex:
|
||||
- rect: [130, 240, 100, 100]
|
||||
radius: [128, 32]
|
||||
clip-mode: clip-out
|
||||
- type: clip-chain
|
||||
id: 205
|
||||
clips: [105]
|
||||
- type: rect
|
||||
bounds: [130, 240, 100, 100]
|
||||
color: green
|
||||
complex-clip:
|
||||
rect: [130, 240, 100, 100]
|
||||
radius: [128, 32]
|
||||
clip-mode: clip-out
|
||||
clip-chain: 205
|
||||
|
||||
- type: clip
|
||||
id: 106
|
||||
complex:
|
||||
- rect: [20, 350, 100, 100]
|
||||
radius: [32, 128]
|
||||
- type: clip-chain
|
||||
id: 206
|
||||
clips: [106]
|
||||
- type: rect
|
||||
bounds: [20, 350, 100, 100]
|
||||
color: red
|
||||
complex-clip:
|
||||
rect: [20, 350, 100, 100]
|
||||
radius: [32, 128]
|
||||
clip-chain: 206
|
||||
|
||||
- type: clip
|
||||
id: 107
|
||||
complex:
|
||||
- rect: [130, 350, 100, 100]
|
||||
radius: [32, 128]
|
||||
clip-mode: clip-out
|
||||
- type: clip-chain
|
||||
id: 207
|
||||
clips: [107]
|
||||
- type: rect
|
||||
bounds: [130, 350, 100, 100]
|
||||
color: green
|
||||
complex-clip:
|
||||
rect: [130, 350, 100, 100]
|
||||
radius: [32, 128]
|
||||
clip-mode: clip-out
|
||||
|
||||
clip-chain: 207
|
||||
|
@ -1,17 +1,31 @@
|
||||
---
|
||||
root:
|
||||
items:
|
||||
- type: clip
|
||||
id: 2
|
||||
bounds: [20, 20, 100, 100]
|
||||
complex:
|
||||
- rect: [20, 20, 100, 100]
|
||||
radius: 32
|
||||
- type: clip-chain
|
||||
id: 12
|
||||
clips: [2]
|
||||
- type: rect
|
||||
bounds: [20, 20, 100, 100]
|
||||
color: red
|
||||
complex-clip:
|
||||
rect: [20, 20, 100, 100]
|
||||
radius: 32
|
||||
clip-chain: 12
|
||||
|
||||
- type: clip
|
||||
id: 3
|
||||
bounds: [130, 20, 100, 100]
|
||||
complex:
|
||||
- rect: [130, 20, 100, 100]
|
||||
radius: 32
|
||||
clip-mode: clip-out
|
||||
- type: clip-chain
|
||||
id: 13
|
||||
clips: [3]
|
||||
- type: rect
|
||||
bounds: [130, 20, 100, 100]
|
||||
color: green
|
||||
complex-clip:
|
||||
rect: [130, 20, 100, 100]
|
||||
radius: 32
|
||||
clip-mode: clip-out
|
||||
clip-chain: 13
|
||||
|
@ -1,6 +1,14 @@
|
||||
---
|
||||
root:
|
||||
items:
|
||||
- type: clip
|
||||
id: 101
|
||||
complex:
|
||||
- rect: [100, 100, 760, 340]
|
||||
radius: [32, 32]
|
||||
- type: clip-chain
|
||||
id: 201
|
||||
clips: [101]
|
||||
- type: gradient
|
||||
bounds: 0 0 960 540
|
||||
start: 0 0
|
||||
@ -16,6 +24,4 @@ root:
|
||||
0.75, blue,
|
||||
0.75, white,
|
||||
1.0, [100,200,50,1]]
|
||||
complex-clip:
|
||||
rect: [100, 100, 760, 340]
|
||||
radius: [32, 32]
|
||||
clip-chain: 201
|
||||
|
@ -1,6 +1,14 @@
|
||||
---
|
||||
root:
|
||||
items:
|
||||
- type: clip
|
||||
id: 101
|
||||
complex:
|
||||
- rect: [100, 100, 760, 340]
|
||||
radius: [32, 32]
|
||||
- type: clip-chain
|
||||
id: 201
|
||||
clips: [101]
|
||||
- type: gradient
|
||||
bounds: 0 0 480 540
|
||||
start: 0 0
|
||||
@ -11,9 +19,16 @@ root:
|
||||
0.5, green,
|
||||
0.75, yellow,
|
||||
1.0, green]
|
||||
complex-clip:
|
||||
rect: [100, 100, 760, 340]
|
||||
radius: [32, 32]
|
||||
clip-chain: 201
|
||||
|
||||
- type: clip
|
||||
id: 102
|
||||
complex:
|
||||
- rect: [100, 100, 760, 340]
|
||||
radius: [32, 32]
|
||||
- type: clip-chain
|
||||
id: 202
|
||||
clips: [102]
|
||||
- type: gradient
|
||||
bounds: 480 0 480 540
|
||||
start: 0 0
|
||||
@ -23,6 +38,4 @@ root:
|
||||
0.5, blue,
|
||||
0.5, white,
|
||||
1.0, [100,200,50,1]]
|
||||
complex-clip:
|
||||
rect: [100, 100, 760, 340]
|
||||
radius: [32, 32]
|
||||
clip-chain: 202
|
||||
|
@ -13,13 +13,19 @@ root:
|
||||
- type: rect
|
||||
color: [180, 140, 120, 0.4]
|
||||
bounds: 2400 2400 8192 8192
|
||||
- type: clip
|
||||
id: 101
|
||||
complex:
|
||||
- rect: [1920, 1920, 4096, 4096]
|
||||
radius: [2048, 2048]
|
||||
- type: clip-chain
|
||||
id: 201
|
||||
clips: [101]
|
||||
- type: "stacking-context"
|
||||
bounds: [0, 0, 8192, 8192]
|
||||
filters: [invert(1)]
|
||||
mix-blend-mode: exclusion
|
||||
complex-clip:
|
||||
rect: [1920, 1920, 4096, 4096]
|
||||
radius: [2048, 2048]
|
||||
clip-chain: 201
|
||||
items:
|
||||
- type: "stacking-context"
|
||||
transform: scale(24)
|
||||
|
@ -13,13 +13,19 @@ root:
|
||||
- type: rect
|
||||
color: [180, 140, 120, 0.4]
|
||||
bounds: 600 600 2048 2048
|
||||
- type: clip
|
||||
id: 101
|
||||
complex:
|
||||
- rect: [480, 480, 1024, 1024]
|
||||
radius: [512, 512]
|
||||
- type: clip-chain
|
||||
id: 201
|
||||
clips: [101]
|
||||
- type: "stacking-context"
|
||||
bounds: [0, 0, 2048, 2048]
|
||||
filters: [invert(1)]
|
||||
mix-blend-mode: exclusion
|
||||
complex-clip:
|
||||
rect: [480, 480, 1024, 1024]
|
||||
radius: [512, 512]
|
||||
clip-chain: 201
|
||||
items:
|
||||
- type: "stacking-context"
|
||||
transform: scale(6)
|
||||
|
@ -11,10 +11,16 @@ root:
|
||||
type: "stacking-context"
|
||||
transform: rotate-x(-60) rotate-y(-120)
|
||||
items:
|
||||
- type: clip
|
||||
id: 101
|
||||
complex:
|
||||
- rect: [128, 128, 256, 256]
|
||||
radius: [64, 32]
|
||||
- type: clip-chain
|
||||
id: 201
|
||||
clips: [101]
|
||||
-
|
||||
bounds: [128, 128, 256, 256]
|
||||
type: rect
|
||||
color: blue
|
||||
complex-clip:
|
||||
rect: [128, 128, 256, 256]
|
||||
radius: [64, 32]
|
||||
clip-chain: 201
|
||||
|
@ -15,11 +15,16 @@ root:
|
||||
bounds: [0, 0, 100, 100]
|
||||
type: rect
|
||||
color: red
|
||||
- type: clip
|
||||
id: 101
|
||||
complex:
|
||||
- rect: [0, 0, 100, 100]
|
||||
radius: 16
|
||||
- type: clip-chain
|
||||
id: 201
|
||||
clips: [101]
|
||||
-
|
||||
bounds: [0, 0, 100, 100]
|
||||
type: rect
|
||||
color: green
|
||||
complex-clip:
|
||||
rect: [0, 0, 100, 100]
|
||||
radius: 16
|
||||
|
||||
clip-chain: 201
|
||||
|
@ -9,12 +9,18 @@ root:
|
||||
items:
|
||||
- image: checkerboard(0, 512, 16);
|
||||
bounds: [1600, 1600, 8192, 8192]
|
||||
- type: clip
|
||||
id: 101
|
||||
complex:
|
||||
- rect: [2048, 2048, 4096, 4096]
|
||||
radius: [1024, 1024]
|
||||
- type: clip-chain
|
||||
id: 201
|
||||
clips: [101]
|
||||
- type: "stacking-context"
|
||||
bounds: [0, 0, 8192, 8192]
|
||||
mix-blend-mode: difference
|
||||
complex-clip:
|
||||
rect: [2048, 2048, 4096, 4096]
|
||||
radius: [1024, 1024]
|
||||
clip-chain: 201
|
||||
items:
|
||||
- image: checkerboard(0, 4096, 2);
|
||||
bounds: [0, 0, 8192, 8192]
|
||||
|
@ -9,12 +9,18 @@ root:
|
||||
items:
|
||||
- image: checkerboard(0, 128, 16);
|
||||
bounds: 400 400 2048 2048
|
||||
- type: clip
|
||||
id: 101
|
||||
complex:
|
||||
- rect: [512, 512, 1024, 1024]
|
||||
radius: [256, 256]
|
||||
- type: clip-chain
|
||||
id: 201
|
||||
clips: [101]
|
||||
- type: "stacking-context"
|
||||
bounds: [0, 0, 2048, 2048]
|
||||
mix-blend-mode: difference
|
||||
complex-clip:
|
||||
rect: [512, 512, 1024, 1024]
|
||||
radius: [256, 256]
|
||||
clip-chain: 201
|
||||
items:
|
||||
- image: checkerboard(0, 1024, 2);
|
||||
bounds: [0, 0, 2048, 2048]
|
||||
|
@ -1540,14 +1540,6 @@ impl YamlFrameReader {
|
||||
);
|
||||
}
|
||||
|
||||
fn get_complex_clip_for_item(&mut self, yaml: &Yaml) -> Option<ComplexClipRegion> {
|
||||
let complex_clip = &yaml["complex-clip"];
|
||||
if complex_clip.is_badvalue() {
|
||||
return None;
|
||||
}
|
||||
Some(complex_clip.as_complex_clip_region())
|
||||
}
|
||||
|
||||
fn get_item_type_from_yaml(item: &Yaml) -> &str {
|
||||
let shorthands = [
|
||||
"rect",
|
||||
@ -1596,27 +1588,17 @@ impl YamlFrameReader {
|
||||
self.spatial_id_stack.push(scroll_id);
|
||||
}
|
||||
|
||||
let complex_clip = self.get_complex_clip_for_item(item);
|
||||
let clip_rect = item["clip-rect"].as_rect().unwrap_or(full_clip);
|
||||
|
||||
let pushed_clip = complex_clip.map_or(false, |complex_clip| {
|
||||
if matches!(item_type, "clip" | "clip-chain" | "scroll-frame") {
|
||||
false
|
||||
} else {
|
||||
let id = dl.define_clip_rounded_rect(
|
||||
&self.top_space_and_clip(),
|
||||
complex_clip,
|
||||
);
|
||||
self.clip_id_stack.push(id);
|
||||
true
|
||||
}
|
||||
});
|
||||
|
||||
let SpaceAndClipInfo {
|
||||
spatial_id,
|
||||
clip_id,
|
||||
mut clip_id,
|
||||
} = self.top_space_and_clip();
|
||||
|
||||
if let Some(clip_chain_id) = self.to_clip_chain_id(&item["clip-chain"]) {
|
||||
clip_id = ClipId::ClipChain(clip_chain_id);
|
||||
}
|
||||
|
||||
let mut flags = PrimitiveFlags::default();
|
||||
for (key, flag) in [
|
||||
("backface-visible", PrimitiveFlags::IS_BACKFACE_VISIBLE),
|
||||
@ -1628,6 +1610,7 @@ impl YamlFrameReader {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let mut info = CommonItemProperties {
|
||||
clip_rect,
|
||||
clip_id,
|
||||
@ -1663,9 +1646,6 @@ impl YamlFrameReader {
|
||||
_ => println!("Skipping unknown item type: {:?}", item),
|
||||
}
|
||||
|
||||
if pushed_clip {
|
||||
self.clip_id_stack.pop().unwrap();
|
||||
}
|
||||
if set_clip_id.is_some() {
|
||||
self.clip_id_stack.pop().unwrap();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user