Skip to content

Commit

Permalink
Merge pull request rust-windowing#482 from Adjective-Object/canvas-sc…
Browse files Browse the repository at this point in the history
…ale-coords-fix

Scale offset in source image's own coordinate space
  • Loading branch information
jdm authored Nov 26, 2021
2 parents a82bad9 + c5da885 commit 842a897
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion canvas/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ impl CanvasRenderingContext2D {
where I: CanvasImageSource, L: CanvasImageDestLocation {
let dest_size = dest_location.size().unwrap_or(src_location.size());
let scale = dest_size / src_location.size();
let offset = dest_location.origin() - src_location.origin();
let offset = dest_location.origin() - src_location.origin() * scale;
let transform = Transform2F::from_scale(scale).translate(offset);

let pattern = image.to_pattern(self, transform);
Expand Down

0 comments on commit 842a897

Please sign in to comment.