mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Hash a gradient fill's kept Photoshop interpolation with its other fields
This commit is contained in:
1 parent
0a4ad3e483
commit
17148706c8
1 file changed
+17
-1
+17
-1
@@ -445,7 +445,7 @@ impl std::hash::Hash for Fill {
|
||||
std::mem::discriminant(self).hash(h);
|
||||
match self {
|
||||
Fill::Solid(c) => color(h, c),
|
||||
Fill::Gradient { stops, angle, scale, style, reverse, opacity_stops, midpoints, offset, dither, align } => {
|
||||
Fill::Gradient { stops, angle, scale, style, reverse, opacity_stops, midpoints, offset, dither, align, interpolation } => {
|
||||
stops.len().hash(h);
|
||||
for (at, c) in stops {
|
||||
bits(*at).hash(h);
|
||||
@@ -458,6 +458,22 @@ impl std::hash::Hash for Fill {
|
||||
opacity_stops.iter().for_each(|(a, b)| [bits(*a), bits(*b)].hash(h));
|
||||
midpoints.len().hash(h);
|
||||
midpoints.iter().for_each(|m| bits(*m).hash(h));
|
||||
interpolation.is_some().hash(h);
|
||||
if let Some(source) = interpolation {
|
||||
let effects::GradientInterpolation { method, smoothness, stops, midpoints, opacity_stops, opacity_midpoints } = &**source;
|
||||
(method, bits(*smoothness)).hash(h);
|
||||
stops.len().hash(h);
|
||||
for (at, c) in stops {
|
||||
bits(*at).hash(h);
|
||||
color(h, c);
|
||||
}
|
||||
opacity_stops.len().hash(h);
|
||||
opacity_stops.iter().for_each(|(a, b)| [bits(*a), bits(*b)].hash(h));
|
||||
for list in [midpoints, opacity_midpoints] {
|
||||
list.len().hash(h);
|
||||
list.iter().for_each(|m| bits(*m).hash(h));
|
||||
}
|
||||
}
|
||||
}
|
||||
Fill::Pattern { name, scale, id, angle, link, phase } => {
|
||||
(name, id, link).hash(h);
|
||||
|
||||
Reference in new issue
Block a user