Fix BrushCache serailization (#1358)

This commit is contained in:
Dennis Kobert 2023-08-04 20:34:54 +02:00 committed by GitHub
parent a267582b4c
commit 94a0f8282e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -23,7 +23,7 @@ struct BrushCacheImpl {
last_stroke_texture: ImageFrame<Color>,
// A cache for brush textures.
#[serde(skip)]
#[cfg_attr(feature = "serde", serde(skip))]
brush_texture_cache: HashMap<BrushStyle, Image<Color>>,
}
@ -99,6 +99,7 @@ pub struct BrushPlan {
pub first_stroke_point_skip: usize,
}
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, DynAny, Default)]
pub struct BrushCache {
inner: Arc<Mutex<BrushCacheImpl>>,

View file

@ -55,7 +55,6 @@ pub enum TaggedValue {
ManipulatorGroupIds(Vec<graphene_core::uuid::ManipulatorGroupId>),
Font(graphene_core::text::Font),
BrushStrokes(Vec<graphene_core::vector::brush_stroke::BrushStroke>),
#[cfg_attr(feature = "serde", serde(skip))]
BrushCache(BrushCache),
Segments(Vec<graphene_core::raster::ImageFrame<Color>>),
DocumentNode(DocumentNode),
@ -294,7 +293,7 @@ impl<'a> TaggedValue {
x if x == TypeId::of::<Vec<graphene_core::uuid::ManipulatorGroupId>>() => Ok(TaggedValue::ManipulatorGroupIds(*downcast(input).unwrap())),
x if x == TypeId::of::<graphene_core::text::Font>() => Ok(TaggedValue::Font(*downcast(input).unwrap())),
x if x == TypeId::of::<Vec<graphene_core::vector::brush_stroke::BrushStroke>>() => Ok(TaggedValue::BrushStrokes(*downcast(input).unwrap())),
x if x == TypeId::of::<Vec<BrushCache>>() => Ok(TaggedValue::BrushCache(*downcast(input).unwrap())),
x if x == TypeId::of::<BrushCache>() => Ok(TaggedValue::BrushCache(*downcast(input).unwrap())),
x if x == TypeId::of::<graphene_core::raster::IndexNode<Vec<graphene_core::raster::ImageFrame<Color>>>>() => Ok(TaggedValue::Segments(*downcast(input).unwrap())),
x if x == TypeId::of::<crate::document::DocumentNode>() => Ok(TaggedValue::DocumentNode(*downcast(input).unwrap())),
x if x == TypeId::of::<graphene_core::GraphicGroup>() => Ok(TaggedValue::GraphicGroup(*downcast(input).unwrap())),