Effects: padded buffers stay within a pixel budget (#2261)

Effects that grow their buffer (CC Radial Fast Blur, CC Lens, Magnify,
the distorts and blurs) could pad a 20 x 20 layer by 4096 px a side, a
~8200 x 8200 f32 buffer plus its clone. Buf::pad (CPU and GPU) now cuts
the pad so the grown buffer stays within 16 Mpx or four times its own
area, whichever is larger: small layers are bounded at 256 MiB, big
layers still grow as before in practice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic
2026-10-30 04:32:17 +07:00
co-authored by Claude Opus 5.5
parent f868cc68f3
commit fb2fb169dc
2 changed files with 35 additions and 1 deletions
+1
View File
@@ -46,6 +46,7 @@ impl GBuf {
/// Buf::pad: grow by `pad` transparent pixels on every side.
pub fn pad(&mut self, e: &mut Enc, pad: u32) -> Option<()> {
let pad = effectcraft_effects::pad_within_budget(self.img.width, self.img.height, pad);
if pad == 0 {
return Some(());
}