From 086e8e613dfc951f869b6f6ebb9ebcba012ab25a Mon Sep 17 00:00:00 2001 From: longmathemagician Date: Thu, 28 Jul 2022 16:10:11 -0700 Subject: [PATCH] Fix drawing of cropped images Calls CoreGraphicsContext::draw_image() from CoreGraphicsContext::draw_image_area() after cropping the image. --- piet-coregraphics/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/piet-coregraphics/src/lib.rs b/piet-coregraphics/src/lib.rs index 07eaa789..7e2e7bab 100644 --- a/piet-coregraphics/src/lib.rs +++ b/piet-coregraphics/src/lib.rs @@ -382,8 +382,7 @@ impl<'a> RenderContext for CoreGraphicsContext<'a> { ) { if let CoreGraphicsImage::NonEmpty(image) = image { if let Some(cropped) = image.cropped(to_cgrect(src_rect)) { - // TODO: apply interpolation mode - self.ctx.draw_image(to_cgrect(dst_rect), &cropped); + self.draw_image(&CoreGraphicsImage::NonEmpty(cropped), dst_rect, _interp); } } }