mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-18 07:48:02 +08:00
Add the rank-model extend concatenating two sources at the top level
This commit is contained in:
@@ -75,4 +75,10 @@ impl LevelIn {
|
||||
pub fn pushed(&self) -> bool {
|
||||
self.level + 1 == self.depth
|
||||
}
|
||||
|
||||
/// Whether the query targets the topmost level; `pushed` under the name a
|
||||
/// non-creator (concat, remap) reads naturally.
|
||||
pub fn top(&self) -> bool {
|
||||
self.pushed()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,6 +185,16 @@ impl Extent {
|
||||
_ => Extent::Free,
|
||||
})
|
||||
}
|
||||
|
||||
/// The sum of two extents, used to concatenate a level; a free operand
|
||||
/// counts as one lane, so a scalar edge joins a concat as a single item.
|
||||
pub fn sum(a: GPoll<Extent>, b: GPoll<Extent>) -> GPoll<Extent> {
|
||||
let lanes = |extent| match extent {
|
||||
Extent::Exactly(count) => count,
|
||||
Extent::Free => 1,
|
||||
};
|
||||
a.zip(b).map(|(a, b)| Extent::Exactly(lanes(a) + lanes(b)))
|
||||
}
|
||||
}
|
||||
|
||||
/// A query over a node's nesting levels: one level, the product below or above
|
||||
|
||||
@@ -490,6 +490,15 @@ impl<'a, N> LazyInput<'a, N> {
|
||||
{
|
||||
self.cell.eval_input(self.input_index, self.node, ctx)
|
||||
}
|
||||
|
||||
/// The edge's composite extent, for kernels that split or shift indices
|
||||
/// over their sources.
|
||||
pub fn extent<Input>(&self, ctx: &Input, at: Level) -> GPoll<Extent>
|
||||
where
|
||||
N: Node<Input>,
|
||||
{
|
||||
self.node.extent(ctx, at)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user