mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
* OpenRaster: layer locks no longer change silently on save (#7018) Co-Authored-By: Claude Opus 5.5 <[email protected]> * ORA: the Background's position lock is not reported as lost (#7018) Every new document's Background carries a position lock, so the warning made a plain .ora unsavable in place. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
a914c58a63
commit
44dc7c2c77
2 files changed
+21
No files matched your search
@@ -566,6 +566,15 @@ impl Writer<'_> {
|
||||
if layer.locks.all || layer.locks.pixels {
|
||||
attrs.push_str(" edit-locked=\"true\"");
|
||||
}
|
||||
// OpenRaster's one edit lock reopens as Lock All; it has no position lock (#7018).
|
||||
if layer.locks.pixels && !layer.locks.all {
|
||||
self.warnings.layer(&layer.name, "Lock Image Pixels was saved as OpenRaster's edit lock; it reopens as Lock All");
|
||||
}
|
||||
// The Background's position lock is part of being the Background, not one the user set:
|
||||
// every new document has it, and OpenRaster has no Background to keep it on.
|
||||
if layer.locks.position && !layer.locks.all && !self.doc.is_background(layer.id) {
|
||||
self.warnings.layer(&layer.name, "Lock Position is not saved to OpenRaster");
|
||||
}
|
||||
if layer.locks.transparency {
|
||||
attrs.push_str(" alpha-preserve=\"true\"");
|
||||
}
|
||||
|
||||
@@ -494,6 +494,9 @@ fn lossy_documents() -> Vec<(&'static str, Document)> {
|
||||
}),
|
||||
("clipped", with(&|d| d.layers[1].clipped = true)),
|
||||
("fill opacity", with(&|d| d.layers[0].fill_opacity = 0.5)),
|
||||
("pixel lock", with(&|d| d.layers[0].locks.pixels = true)),
|
||||
// Not the bottom layer: with its transparency lock, `Base` would become the Background.
|
||||
("position lock", with(&|d| d.layers[1].locks.position = true)),
|
||||
("float", doc(SampleType::F32)),
|
||||
("profile", with(&|d| d.icc_profile = Some(photocraft_cms::Builtin::DisplayP3.profile().to_bytes()))),
|
||||
("metadata", with(&|d| d.metadata.xmp = Some("<x/>".into()))),
|
||||
@@ -520,6 +523,15 @@ fn plain_documents_lose_nothing() {
|
||||
d.icc_profile = Some(photocraft_cms::Builtin::Srgb.profile().to_bytes());
|
||||
assert_eq!(losses(&d), Vec::<String>::new(), "{depth:?} tagged sRGB");
|
||||
assert_eq!(export(&d).unwrap().warnings, Vec::<String>::new());
|
||||
// OpenRaster's edit-locked and alpha-preserve hold Lock All and Lock Transparent Pixels.
|
||||
d.layers[0].locks.all = true;
|
||||
d.layers[1].locks.transparency = true;
|
||||
assert_eq!(losses(&d), Vec::<String>::new(), "{depth:?} locked");
|
||||
// A Background (every new document's bottom layer) loses nothing for its position lock.
|
||||
d.layers[0].locks.all = false;
|
||||
d.layers[0].locks.position = true;
|
||||
assert!(d.background().is_some());
|
||||
assert_eq!(losses(&d), Vec::<String>::new(), "{depth:?} Background");
|
||||
}
|
||||
let mut cmyk = doc(SampleType::U8);
|
||||
cmyk.mode = ColorMode::Cmyk;
|
||||
|
||||
Reference in new issue
Block a user