mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-16 23:24:22 +00:00
PSD export: check the Background's opacity from its tiles (#5998)
This commit is contained in:
1 parent
c136d2dd3d
commit
f5af2f3ef5
2 files changed
+2
-4
No files matched your search
@@ -495,7 +495,7 @@ fn drop_alpha(data: &mut Vec<u8>, color: usize, alpha: usize) {
|
||||
}
|
||||
|
||||
/// Whether every pixel of `s` over `r` is fully opaque (read from the tiles, no copy).
|
||||
fn opaque_surface(s: &Surface, r: Rect) -> bool {
|
||||
pub(crate) fn opaque_surface(s: &Surface, r: Rect) -> bool {
|
||||
let fmt = s.format();
|
||||
let (ch, bps) = (fmt.channels(), fmt.sample.bytes());
|
||||
let a = ch - 1;
|
||||
|
||||
@@ -107,9 +107,7 @@ fn psd_background(doc: &Document) -> Option<photocraft_doc::LayerId> {
|
||||
if canvas.is_empty() || s.content_bounds() != canvas {
|
||||
return None;
|
||||
}
|
||||
let n = s.channels();
|
||||
let opaque = s.read_region(canvas).chunks_exact(n).all(|p| p.last().is_some_and(|a| *a >= 1.0));
|
||||
opaque.then_some(l.id)
|
||||
crate::flat::opaque_surface(s, canvas).then_some(l.id)
|
||||
}
|
||||
|
||||
/// How deep embedded documents are exported inside each other before a smart object is written
|
||||
|
||||
Reference in new issue
Block a user