mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-29 06:28:12 +08:00
Trim comment narration and stale marker references
This commit is contained in:
@@ -910,8 +910,6 @@ pub fn set_stroke_paint_order(network_interface: &mut NodeNetworkInterface, netw
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Swap the pair in place: the downstream node takes the upstream one's source, consumers of the
|
|
||||||
// downstream node move over to the upstream one, and the wire linking the pair reverses direction
|
|
||||||
let (upstream, downstream) = if currently_above { (fill_node_id, stroke_node_id) } else { (stroke_node_id, fill_node_id) };
|
let (upstream, downstream) = if currently_above { (fill_node_id, stroke_node_id) } else { (stroke_node_id, fill_node_id) };
|
||||||
let Some(upstream_source) = network_interface.input_from_connector(&InputConnector::node(upstream, 0), network_path).cloned() else {
|
let Some(upstream_source) = network_interface.input_from_connector(&InputConnector::node(upstream, 0), network_path).cloned() else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
//! Data uniform across all covers (the paint) rides the outer `List<Coverage>` so columnar presence holds,
|
//! Data uniform across all covers (the paint) rides the outer `List<Coverage>` so columnar presence holds,
|
||||||
//! while cover-specific data rides the inner `Item<Cover>`, reusing `ATTR_TRANSFORM` for the stroke-authoring space.
|
//! while cover-specific data rides the inner `Item<Cover>`, reusing `ATTR_TRANSFORM` for the stroke-authoring space.
|
||||||
//!
|
//!
|
||||||
//! The interior is `'static` in this first form: the paint column stores `Graphic<'static>`, exactly as the
|
//! The interior is `'static`: the paint column stores `Graphic<'static>`.
|
||||||
//! `Fill` marker's paint list does today. Native-resident interiors are the recorded follow-up.
|
|
||||||
|
|
||||||
use crate::Graphic;
|
use crate::Graphic;
|
||||||
use crate::markers::ATTR_PAINT;
|
use crate::markers::ATTR_PAINT;
|
||||||
@@ -36,8 +35,7 @@ impl std::fmt::Display for Cover {
|
|||||||
#[derive(Clone, Debug, Default, dyn_any::DynAny)]
|
#[derive(Clone, Debug, Default, dyn_any::DynAny)]
|
||||||
pub struct Coverage(pub Item<Cover>);
|
pub struct Coverage(pub Item<Cover>);
|
||||||
|
|
||||||
// Item equality ignores attributes, but the stroke parameters live there, so both impls walk the
|
// Item equality ignores attributes, but the stroke parameters live there.
|
||||||
// attribute pairs in the erased display form, the same comparison `AttributeValueDyn` uses.
|
|
||||||
impl PartialEq for Coverage {
|
impl PartialEq for Coverage {
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
self.0.element() == other.0.element()
|
self.0.element() == other.0.element()
|
||||||
@@ -125,7 +123,6 @@ impl Coverage {
|
|||||||
/// Extracts the stroke parameters into a [`Stroke`], falling back to the default for any absent attribute.
|
/// Extracts the stroke parameters into a [`Stroke`], falling back to the default for any absent attribute.
|
||||||
/// Dash lengths are clamped to non-negative, matching what rendering accepts.
|
/// Dash lengths are clamped to non-negative, matching what rendering accepts.
|
||||||
pub fn stroke_params(&self) -> Stroke {
|
pub fn stroke_params(&self) -> Stroke {
|
||||||
// A single walk of the attribute pairs instead of one keyed scan per parameter, since this runs per item per render pass
|
|
||||||
let mut stroke = Stroke::default();
|
let mut stroke = Stroke::default();
|
||||||
for (key, value) in self.0.attributes().iter() {
|
for (key, value) in self.0.attributes().iter() {
|
||||||
match key {
|
match key {
|
||||||
|
|||||||
@@ -367,9 +367,8 @@ fn fill<'e>(
|
|||||||
Ok((element, Attr(Some(parked_appearance))))
|
Ok((element, Attr(Some(parked_appearance))))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The fill over graphic lanes: the marker parks on the lane and the render
|
/// The fill over graphic lanes: the appearance parks on the lane and cascades
|
||||||
/// boundary moves it onto the interior vector lists the legacy paint readers
|
/// to the vectors beneath it. Registered under the fill's identifier.
|
||||||
/// inspect. Registered under the fill's identifier.
|
|
||||||
#[node_macro::node(category(""))]
|
#[node_macro::node(category(""))]
|
||||||
fn fill_graphic_leveled<'e>(
|
fn fill_graphic_leveled<'e>(
|
||||||
ctx: impl Ctx + ExtractArena<'e> + ExtractIndex + InjectIndex + Copy,
|
ctx: impl Ctx + ExtractArena<'e> + ExtractIndex + InjectIndex + Copy,
|
||||||
@@ -433,22 +432,19 @@ fn stroke<'e>(
|
|||||||
transform: DAffine2::IDENTITY,
|
transform: DAffine2::IDENTITY,
|
||||||
};
|
};
|
||||||
|
|
||||||
// The coverage records the stroke's authoring space, so the item transform is composed in, translation
|
// The coverage records the stroke's authoring space: the item transform, translation included
|
||||||
// included so the render consumers see the exact legacy stroke space.
|
|
||||||
let mut coverage_stroke = stroke;
|
let mut coverage_stroke = stroke;
|
||||||
coverage_stroke.transform *= *content_transform;
|
coverage_stroke.transform *= *content_transform;
|
||||||
|
|
||||||
let paint = paint_table(paint);
|
let paint = paint_table(paint);
|
||||||
// The paint order is the coverage row order: appending above follows the painter's algorithm, and a
|
// A below stroke is the chain running the stroke node before the fill, so the coverage appends above
|
||||||
// below stroke is expressed by the chain running the stroke node before the fill
|
|
||||||
let appearance = stamped_appearance(*content_appearance, Coverage::new_stroke(&coverage_stroke), &paint, CoverPlacement::Above);
|
let appearance = stamped_appearance(*content_appearance, Coverage::new_stroke(&coverage_stroke), &paint, CoverPlacement::Above);
|
||||||
let parked_appearance = park_appearance(ctx.arena(), appearance)?;
|
let parked_appearance = park_appearance(ctx.arena(), appearance)?;
|
||||||
Ok((element, Attr(*content_transform), Attr(Some(parked_appearance))))
|
Ok((element, Attr(*content_transform), Attr(Some(parked_appearance))))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The stroke over graphic lanes: the style applies to the interior vectors,
|
/// The stroke over graphic lanes: the appearance parks on the lane and cascades
|
||||||
/// the paint marker parks on the lane for the render boundary to place.
|
/// to the vectors beneath it. Registered under the stroke's identifier.
|
||||||
/// Registered under the stroke's identifier.
|
|
||||||
#[node_macro::node(category(""))]
|
#[node_macro::node(category(""))]
|
||||||
fn stroke_graphic_leveled<'e>(
|
fn stroke_graphic_leveled<'e>(
|
||||||
ctx: impl Ctx + ExtractArena<'e> + ExtractIndex + InjectIndex + Copy,
|
ctx: impl Ctx + ExtractArena<'e> + ExtractIndex + InjectIndex + Copy,
|
||||||
@@ -476,13 +472,12 @@ fn stroke_graphic_leveled<'e>(
|
|||||||
transform: DAffine2::IDENTITY,
|
transform: DAffine2::IDENTITY,
|
||||||
};
|
};
|
||||||
|
|
||||||
// The coverage records the stroke's authoring space at the lane, composing the lane transform as in `stroke` above.
|
// The coverage records the stroke's authoring space: the lane transform, translation included
|
||||||
let mut coverage_stroke = stroke;
|
let mut coverage_stroke = stroke;
|
||||||
coverage_stroke.transform *= *content_transform;
|
coverage_stroke.transform *= *content_transform;
|
||||||
|
|
||||||
let paint = paint_table(paint);
|
let paint = paint_table(paint);
|
||||||
// The paint order is the coverage row order: appending above follows the painter's algorithm, and a
|
// A below stroke is the chain running the stroke node before the fill, so the coverage appends above
|
||||||
// below stroke is expressed by the chain running the stroke node before the fill
|
|
||||||
let appearance = stamped_appearance(*content_appearance, Coverage::new_stroke(&coverage_stroke), &paint, CoverPlacement::Above);
|
let appearance = stamped_appearance(*content_appearance, Coverage::new_stroke(&coverage_stroke), &paint, CoverPlacement::Above);
|
||||||
let parked_appearance = park_appearance(ctx.arena(), appearance)?;
|
let parked_appearance = park_appearance(ctx.arena(), appearance)?;
|
||||||
Ok((element, Attr(*content_transform), Attr(Some(parked_appearance))))
|
Ok((element, Attr(*content_transform), Attr(Some(parked_appearance))))
|
||||||
@@ -2710,8 +2705,8 @@ fn morph_core(flattened: List<Vector>, snapshot: List<Graphic<'static>>, progres
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lerp between two appearances, pairing coverages by cover so a fill and a stroke never interpolate into each other.
|
/// Lerps two appearances pairing coverages by cover, so a fill and a stroke never interpolate into each other.
|
||||||
// Stroke parameter pairs interpolate; other coverage pairings and the paint order step at the midpoint.
|
/// Stroke parameter pairs interpolate; other coverage pairings and the paint order step at the midpoint.
|
||||||
fn lerp_appearance(a: Option<&Appearance>, b: Option<&Appearance>, time: f64) -> Option<Appearance> {
|
fn lerp_appearance(a: Option<&Appearance>, b: Option<&Appearance>, time: f64) -> Option<Appearance> {
|
||||||
if a.is_none() && b.is_none() {
|
if a.is_none() && b.is_none() {
|
||||||
return None;
|
return None;
|
||||||
|
|||||||
Reference in New Issue
Block a user