Skip to content

Commit c5da885

Browse files
Scale offset in source image's own cooridnate space
This fixes #481
1 parent a82bad9 commit c5da885

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)