Skip to content

Commit 586f80d

Browse files
committed
[cg] Correct image orientation when drawing
1 parent 1b397f1 commit 586f80d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

piet-coregraphics/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,13 @@ impl<'a> RenderContext for CoreGraphicsContext<'a> {
308308
_interp: InterpolationMode,
309309
) {
310310
// TODO: apply interpolation mode
311-
self.ctx.draw_image(to_cgrect(rect), image);
311+
self.ctx.save();
312+
let rect = to_cgrect(rect);
313+
// CGImage is drawn flipped by default
314+
self.ctx.translate(0., rect.size.height);
315+
self.ctx.scale(1.0, -1.0);
316+
self.ctx.draw_image(rect, image);
317+
self.ctx.restore();
312318
}
313319

314320
fn draw_image_area(

0 commit comments

Comments
 (0)