mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 10:58:04 +08:00
Drop unread index bounds from fold kernels and mark re-addressing nodes ModifyIndex
This commit is contained in:
@@ -149,5 +149,5 @@ fn read_index(
|
||||
) -> f64 {
|
||||
// The chain's innermost entry is the consuming wire's own lane from the
|
||||
// decompose-and-promote split; the loops the reader counts sit above it.
|
||||
ctx.try_index().and_then(|mut iter| iter.nth(loop_level as usize + 1).or_else(|| iter.last())).unwrap_or(0) as f64
|
||||
ctx.try_index().and_then(|mut iter| iter.nth(loop_level as usize + 1)).unwrap_or(0) as f64
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use core_types::arena::ArenaCell;
|
||||
use core_types::context::{Ctx, CtxSnapshot, DeriveCtx, ExtractAll, ExtractIndex, InjectIndex};
|
||||
use core_types::context::{Ctx, CtxSnapshot, DeriveCtx, ExtractAll, ModifyIndex};
|
||||
use core_types::frame_table::{FrameTable, Lookup};
|
||||
use core_types::gpoll::{Finality, GPoll};
|
||||
use core_types::graphene_hash::CacheHash;
|
||||
@@ -31,7 +31,7 @@ pub struct MemoLevel {
|
||||
/// materialization of the content instead of re-evaluating it per lane.
|
||||
#[node_macro::node(category("General"), path(graphene_core::memo))]
|
||||
fn memoize<'e>(
|
||||
ctx: impl Ctx + CacheHash + DeriveCtx + ExtractArena<'e> + ExtractIndex + InjectIndex + Copy,
|
||||
ctx: impl Ctx + CacheHash + DeriveCtx + ExtractArena<'e> + ModifyIndex + Copy,
|
||||
#[data] cache: Arc<Mutex<Option<MemoLevel>>>,
|
||||
content: impl Node<Context<'_>, Output = RecordValue<'e>>,
|
||||
) -> GPoll<RecordValue<'e>> {
|
||||
@@ -188,7 +188,7 @@ type MonitorValue = Arc<Mutex<Option<IORecord<CtxSnapshot, RecordCapture>>>>;
|
||||
/// The Monitor node is used by the editor to access the data flowing through it.
|
||||
#[node_macro::node(category(""), path(graphene_core::memo), serialize(serialize_monitor), properties("monitor_properties"))]
|
||||
fn monitor<'e>(
|
||||
ctx: impl Ctx + DeriveCtx + ExtractAll + ExtractArena<'e> + ExtractIndex + InjectIndex + Copy,
|
||||
ctx: impl Ctx + DeriveCtx + ExtractAll + ExtractArena<'e> + ModifyIndex + Copy,
|
||||
#[data] io: MonitorValue,
|
||||
content: impl Node<Context<'_>, Output = RecordValue<'e>>,
|
||||
) -> GPoll<RecordValue<'e>> {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
use core_types::Ctx;
|
||||
use core_types::attribute::{Attr, EditorLayerPath, Opacity, RemoveAttr, Transform};
|
||||
use core_types::context::{DeriveCtx, ExtractIndex, ExtractIndices, IndexLink, InjectIndex};
|
||||
use core_types::context::{DeriveCtx, ExtractIndex, ExtractIndices, IndexLink, InjectIndex, ModifyIndex};
|
||||
use core_types::extent::{ExtentIn, LevelIn, ListIn, ValueIn};
|
||||
use core_types::gpoll::{ErrorKind, Extent, GPoll, GraphError, Interrupt, Level};
|
||||
use core_types::node::Lane;
|
||||
@@ -63,12 +63,12 @@ fn repeat_opacity(ctx: impl Ctx + ExtractIndex, element: f64, count: u32) -> ILi
|
||||
}
|
||||
|
||||
#[node_macro::node(category("Test"))]
|
||||
fn sum(_: impl Ctx + ExtractIndex + InjectIndex + Copy, items: IList<f64>) -> f64 {
|
||||
fn sum(_: impl Ctx, items: IList<f64>) -> f64 {
|
||||
items.into_iter().sum()
|
||||
}
|
||||
|
||||
#[node_macro::node(category("Test"))]
|
||||
fn sum_nested(_: impl Ctx + ExtractIndex + InjectIndex + Copy, items: IList<IList<f64>>) -> f64 {
|
||||
fn sum_nested(_: impl Ctx, items: IList<IList<f64>>) -> f64 {
|
||||
items.into_iter().sum()
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ fn resolve_index(index: f64, total: u64) -> Option<u64> {
|
||||
/// the omitted index read one lane further. An out-of-range index passes the
|
||||
/// level through unchanged.
|
||||
#[node_macro::node(category("Test"), extent(omit_element_extent))]
|
||||
fn omit_element<T>(ctx: impl Ctx + ExtractIndex + InjectIndex + Copy, content: impl Node<Context<'_>, Output = T>, index: f64) -> Result<T, Interrupt> {
|
||||
fn omit_element<T>(ctx: impl Ctx + ModifyIndex + Copy, content: impl Node<Context<'_>, Output = T>, index: f64) -> Result<T, Interrupt> {
|
||||
let total = match content.extent(ctx, Level::Total) {
|
||||
GPoll::Final(Extent::Exactly(count)) => count as u64,
|
||||
GPoll::Pending => return Err(Interrupt::Pending),
|
||||
@@ -225,7 +225,7 @@ fn omit_element_extent(content: ExtentIn<'_>, index: ValueIn<'_, f64>, level: Le
|
||||
/// Rank-model Index Elements: a one-lane level holding the item at the index
|
||||
/// with its attributes, or an empty level when the index is out of range.
|
||||
#[node_macro::node(category("Test"), extent(index_elements_extent))]
|
||||
fn index_elements<T>(ctx: impl Ctx + ExtractIndex + InjectIndex + Copy, content: impl Node<Context<'_>, Output = T>, index: f64) -> Result<T, Interrupt> {
|
||||
fn index_elements<T>(ctx: impl Ctx + ModifyIndex + Copy, content: impl Node<Context<'_>, Output = T>, index: f64) -> Result<T, Interrupt> {
|
||||
let total = match content.extent(ctx, Level::Total) {
|
||||
GPoll::Final(Extent::Exactly(count)) => count as u64,
|
||||
GPoll::Pending => return Err(Interrupt::Pending),
|
||||
|
||||
Reference in New Issue
Block a user