mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 02:48:12 +08:00
Implement Infrastructure to reuse previous frames for brush drawing
Implement Infrastructuro to reuse the previous evaluation of the node graph to blend the new stroke with instead of drawing the entire trace from scratch. This does not transition to a blending based approach because that still caused regressions but allows the brush node to work with input data natively. Test Plan: - Use the brush tool in the editor and check for regressions - Evaluate the performance Reviewers: Keavon Pull Request: https://github.com/GraphiteEditor/Graphite/pull/1190
This commit is contained in:
committed by
Keavon Chambers
parent
ebf67eaa82
commit
3adcc3031a
@@ -39,8 +39,9 @@ pub trait Node<'i, Input: 'i>: 'i {
|
||||
type Output: 'i;
|
||||
fn eval(&'i self, input: Input) -> Self::Output;
|
||||
fn reset(self: Pin<&mut Self>) {}
|
||||
#[cfg(feature = "alloc")]
|
||||
fn serialize(&self) -> Option<String> {
|
||||
#[cfg(feature = "std")]
|
||||
fn serialize(&self) -> Option<std::sync::Arc<dyn core::any::Any>> {
|
||||
log::warn!("Node::serialize not implemented for {}", core::any::type_name::<Self>());
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +139,7 @@ pub trait UnassociatedAlpha: RGB + Alpha {
|
||||
|
||||
pub trait Alpha {
|
||||
type AlphaChannel: Channel;
|
||||
const TRANSPARENT: Self;
|
||||
fn alpha(&self) -> Self::AlphaChannel;
|
||||
fn a(&self) -> Self::AlphaChannel {
|
||||
self.alpha()
|
||||
|
||||
@@ -96,6 +96,8 @@ impl Pixel for Color {
|
||||
|
||||
impl Alpha for Color {
|
||||
type AlphaChannel = f32;
|
||||
const TRANSPARENT: Self = Self::TRANSPARENT;
|
||||
|
||||
fn alpha(&self) -> f32 {
|
||||
self.alpha
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user