Merge pull request #482 from Adjective-Object/canvas-scale-coords-fix

Scale offset in source image's own coordinate space
This commit is contained in:
Josh Matthews 2021-11-26 09:42:37 -05:00 committed by GitHub
commit 842a897a8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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);