mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 14:18:04 +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;
|
||||
}
|
||||
|
||||
// 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 Some(upstream_source) = network_interface.input_from_connector(&InputConnector::node(upstream, 0), network_path).cloned() else {
|
||||
return false;
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
//! 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.
|
||||
//!
|
||||
//! The interior is `'static` in this first form: the paint column stores `Graphic<'static>`, exactly as the
|
||||
//! `Fill` marker's paint list does today. Native-resident interiors are the recorded follow-up.
|
||||
//! The interior is `'static`: the paint column stores `Graphic<'static>`.
|
||||
|
||||
use crate::Graphic;
|
||||
use crate::markers::ATTR_PAINT;
|
||||
@@ -36,8 +35,7 @@ impl std::fmt::Display for Cover {
|
||||
#[derive(Clone, Debug, Default, dyn_any::DynAny)]
|
||||
pub struct Coverage(pub Item<Cover>);
|
||||
|
||||
// Item equality ignores attributes, but the stroke parameters live there, so both impls walk the
|
||||
// attribute pairs in the erased display form, the same comparison `AttributeValueDyn` uses.
|
||||
// Item equality ignores attributes, but the stroke parameters live there.
|
||||
impl PartialEq for Coverage {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
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.
|
||||
/// Dash lengths are clamped to non-negative, matching what rendering accepts.
|
||||
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();
|
||||
for (key, value) in self.0.attributes().iter() {
|
||||
match key {
|
||||
|
||||
@@ -367,9 +367,8 @@ fn fill<'e>(
|
||||
Ok((element, Attr(Some(parked_appearance))))
|
||||
}
|
||||
|
||||
/// The fill over graphic lanes: the marker parks on the lane and the render
|
||||
/// boundary moves it onto the interior vector lists the legacy paint readers
|
||||
/// inspect. Registered under the fill's identifier.
|
||||
/// The fill over graphic lanes: the appearance parks on the lane and cascades
|
||||
/// to the vectors beneath it. Registered under the fill's identifier.
|
||||
#[node_macro::node(category(""))]
|
||||
fn fill_graphic_leveled<'e>(
|
||||
ctx: impl Ctx + ExtractArena<'e> + ExtractIndex + InjectIndex + Copy,
|
||||
@@ -433,22 +432,19 @@ fn stroke<'e>(
|
||||
transform: DAffine2::IDENTITY,
|
||||
};
|
||||
|
||||
// The coverage records the stroke's authoring space, so the item transform is composed in, translation
|
||||
// included so the render consumers see the exact legacy stroke space.
|
||||
// The coverage records the stroke's authoring space: the item transform, translation included
|
||||
let mut coverage_stroke = stroke;
|
||||
coverage_stroke.transform *= *content_transform;
|
||||
|
||||
let paint = paint_table(paint);
|
||||
// The paint order is the coverage row order: appending above follows the painter's algorithm, and a
|
||||
// below stroke is expressed by the chain running the stroke node before the fill
|
||||
// A below stroke is the chain running the stroke node before the fill, so the coverage appends above
|
||||
let appearance = stamped_appearance(*content_appearance, Coverage::new_stroke(&coverage_stroke), &paint, CoverPlacement::Above);
|
||||
let parked_appearance = park_appearance(ctx.arena(), appearance)?;
|
||||
Ok((element, Attr(*content_transform), Attr(Some(parked_appearance))))
|
||||
}
|
||||
|
||||
/// The stroke over graphic lanes: the style applies to the interior vectors,
|
||||
/// the paint marker parks on the lane for the render boundary to place.
|
||||
/// Registered under the stroke's identifier.
|
||||
/// The stroke over graphic lanes: the appearance parks on the lane and cascades
|
||||
/// to the vectors beneath it. Registered under the stroke's identifier.
|
||||
#[node_macro::node(category(""))]
|
||||
fn stroke_graphic_leveled<'e>(
|
||||
ctx: impl Ctx + ExtractArena<'e> + ExtractIndex + InjectIndex + Copy,
|
||||
@@ -476,13 +472,12 @@ fn stroke_graphic_leveled<'e>(
|
||||
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;
|
||||
coverage_stroke.transform *= *content_transform;
|
||||
|
||||
let paint = paint_table(paint);
|
||||
// The paint order is the coverage row order: appending above follows the painter's algorithm, and a
|
||||
// below stroke is expressed by the chain running the stroke node before the fill
|
||||
// A below stroke is the chain running the stroke node before the fill, so the coverage appends above
|
||||
let appearance = stamped_appearance(*content_appearance, Coverage::new_stroke(&coverage_stroke), &paint, CoverPlacement::Above);
|
||||
let parked_appearance = park_appearance(ctx.arena(), 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.
|
||||
// Stroke parameter pairs interpolate; other coverage pairings and the paint order step at the midpoint.
|
||||
/// 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.
|
||||
fn lerp_appearance(a: Option<&Appearance>, b: Option<&Appearance>, time: f64) -> Option<Appearance> {
|
||||
if a.is_none() && b.is_none() {
|
||||
return None;
|
||||
|
||||
Reference in New Issue
Block a user