Content-Aware Fill: preview at full resolution so it matches the result (#6530) (#6838)

This commit is contained in:
MarekSpodBiedry
2026-10-19 14:19:55 -04:00
committed by GitHub
parent e3224000ca
commit 2cdc8cb73d
+13
View File
@@ -203,6 +203,9 @@ fn is_pixel_param_of(command: &str, key: &str) -> bool {
/// Sharpen, Sharpen More, Sharpen Edges, Find Edges, Emboss and Despeckle use fixed one-pixel
/// kernels with no size parameter, so a proxy changes their look: edges average away, making
/// the sharpening and edge detection invisible. These must preview at full resolution (#3929).
///
/// Content-Aware Fill searches for matching patches, and the matches found on a reduced copy
/// differ from those found at full size, so its preview would not show what OK writes (#6530).
const FULL_RESOLUTION_PREVIEW: &[&str] = &[
"filter.distort.ripple",
"filter.stylize.diffuse",
@@ -225,6 +228,7 @@ const FULL_RESOLUTION_PREVIEW: &[&str] = &[
"filter.stylize.findEdges",
"filter.stylize.emboss",
"filter.noise.despeckle",
"edit.contentAwareFill",
];
/// Whether `command` with `params` previews at full resolution: [`FULL_RESOLUTION_PREVIEW`], every
@@ -2094,6 +2098,15 @@ mod tests {
assert_eq!(preview_factor("image.mode.bitmap", &json!({"method": "threshold"}), 4), 4);
}
/// #6530: the Content-Aware Fill preview runs at full resolution, for every Sampling choice,
/// because its patch search finds different matches on a reduced copy.
#[test]
fn content_aware_fill_previews_at_full_resolution() {
for params in [json!({}), json!({"sampling": "auto"}), json!({"sampling": "rectangular"})] {
assert_eq!(preview_factor("edit.contentAwareFill", &params, 4), 1, "{params}");
}
}
/// #2063: proxy previews scaled what isn't a length (Tree's canvas fraction, Lens Correction's
/// perspective), clamped negative lengths to +0.1 (Offset left/up), left Shadows/Highlights'
/// radii in document pixels and rounded Mosaic's 10 px cells to 3 proxy px (12 px).