mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Allow float luma roundoff in the mask control
This commit is contained in:
1 parent
099df3d4be
commit
d458f5acbb
1 file changed
+3
-1
@@ -67,7 +67,9 @@ fn outside_the_rgb_mask_depths_darker_color_still_keeps_the_darker_backdrop() {
|
||||
("gray", 16, json!("mask")),
|
||||
] {
|
||||
let normal = gradient_row(seeded_surface(mode, depth, &target), &target, "normal");
|
||||
assert_eq!(normal[39], 1.0, "{mode} {depth}-bit {target}");
|
||||
// Float mask luma can be one representable step below white. Integer storage rounds it.
|
||||
let white_tolerance = if depth == 32 { 4.0 * f32::EPSILON } else { 0.0 };
|
||||
assert!((normal[39] - 1.0).abs() <= white_tolerance, "{mode} {depth}-bit {target}: {}", normal[39]);
|
||||
let row = gradient_row(seeded_surface(mode, depth, &target), &target, BlendMode::DarkerColor.label());
|
||||
assert!((row[39] - MASK_LEVEL).abs() < 1.0 / 65535.0, "{mode} {depth}-bit {target}");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user