Skip to content

Commit 842a897

Browse files
authored
Merge pull request #482 from Adjective-Object/canvas-scale-coords-fix
Scale offset in source image's own coordinate space
2 parents a82bad9 + c5da885 commit 842a897

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

canvas/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ impl CanvasRenderingContext2D {
552552
where I: CanvasImageSource, L: CanvasImageDestLocation {
553553
let dest_size = dest_location.size().unwrap_or(src_location.size());
554554
let scale = dest_size / src_location.size();
555-
let offset = dest_location.origin() - src_location.origin();
555+
let offset = dest_location.origin() - src_location.origin() * scale;
556556
let transform = Transform2F::from_scale(scale).translate(offset);
557557

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

0 commit comments

Comments
 (0)