Skip to content

Commit

Permalink
[cg] Correct image orientation when drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
cmyr committed May 11, 2020
1 parent 1b397f1 commit 586f80d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion piet-coregraphics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,13 @@ impl<'a> RenderContext for CoreGraphicsContext<'a> {
_interp: InterpolationMode,
) {
// TODO: apply interpolation mode
self.ctx.draw_image(to_cgrect(rect), image);
self.ctx.save();
let rect = to_cgrect(rect);
// CGImage is drawn flipped by default
self.ctx.translate(0., rect.size.height);
self.ctx.scale(1.0, -1.0);
self.ctx.draw_image(rect, image);
self.ctx.restore();
}

fn draw_image_area(
Expand Down

0 comments on commit 586f80d

Please sign in to comment.