mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-22 06:08:11 +08:00
Switch the Color struct back to storing unassociated alpha (#4518)
* Switch Color struct back to storing unassociated alpha * Address review feedback * Update the Invert node and legacy image migration for straight alpha and add round-trip tests --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
e725f55043
commit
944d00cac5
@@ -802,8 +802,6 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
|
||||
parent_and_insert_index,
|
||||
place_at_origin,
|
||||
} => {
|
||||
// All the image's pixels have been converted to 0..=1, linear, and premultiplied by `Color::from_rgba8_srgb`
|
||||
|
||||
let layer_parent = self.new_layer_parent(true);
|
||||
let image_size = DVec2::new(image.width as f64, image.height as f64);
|
||||
|
||||
|
||||
@@ -2123,7 +2123,9 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
|
||||
_ => None,
|
||||
});
|
||||
|
||||
if let Some(image) = image {
|
||||
if let Some(mut image) = image {
|
||||
// Legacy embedded pixel data is premultiplied, so restore straight alpha before encoding it
|
||||
image.data.iter_mut().for_each(|pixel| *pixel = pixel.to_unassociated_alpha());
|
||||
let hash = document.resources.embedded.store(Resource::new(image.to_png()));
|
||||
|
||||
let resource_id = ResourceId::new();
|
||||
|
||||
Reference in New Issue
Block a user