diff --git a/crates/render/src/raster/tests.rs b/crates/render/src/raster/tests.rs index 7e6466a679..679e42cd5e 100644 --- a/crates/render/src/raster/tests.rs +++ b/crates/render/src/raster/tests.rs @@ -8948,9 +8948,9 @@ fn decoded_images_serve_every_size_they_are_drawn_at() { (cache.decoded_image_decodes() - masks, masks) }; assert_eq!(decodes("A"), (1, 0), "a Flate image decodes the same at every size"); - // The image and its JPX soft mask each decode once for each of the five sizes (the mask goes - // through the cache too since hayro-interpret patch 82). - assert_eq!(decodes("B"), (5, 5), "an image with a JPX soft mask, and the mask, decode for the size they are drawn at"); + // The image decodes once for each of the five sizes, its JPX soft mask within it: only a mask + // averaged down (hayro-interpret patch 82) has a cache entry of its own. + assert_eq!(decodes("B"), (5, 0), "an image with a JPX soft mask decodes for the size it is drawn at"); } /// A soft mask far larger than where its image is drawn is averaged down to that size and cached diff --git a/vendor/hayro-interpret/src/x_object.rs b/vendor/hayro-interpret/src/x_object.rs index 66efd50e3c..849213a7f8 100644 --- a/vendor/hayro-interpret/src/x_object.rs +++ b/vendor/hayro-interpret/src/x_object.rs @@ -678,8 +678,11 @@ impl<'a> ImageXObject<'a> { && (u64::from(self.width) > u64::from(tw) * SOFT_MASK_SHRINK_FACTOR || u64::from(self.height) > u64::from(th) * SOFT_MASK_SHRINK_FACTOR) }); + // Decoded within the image's own decode, as before: the image's cache entry holds it as + // its alpha, and patch (91) keeps that entry when the mask fails, so a second entry for + // the mask would only count it twice. let Some((tw, th)) = shrink_to else { - return self.decoded_mask(target_dimension); + return decode_mask(self, target_dimension); }; // Averaged down to the drawn size rounded up to a power of two (`size_bucket`), so draws a // pixel apart share one mask and the renderer filters the rest, and only on the sides that