Scale offset in source image's own cooridnate space

This fixes https://github.com/servo/pathfinder/issues/481
This commit is contained in:
Maxwell Huang-Hobbs 2021-11-24 11:18:19 -05:00
parent a82bad90da
commit c5da885fec
1 changed files with 1 additions and 1 deletions

View File

@ -552,7 +552,7 @@ impl CanvasRenderingContext2D {
where I: CanvasImageSource, L: CanvasImageDestLocation { where I: CanvasImageSource, L: CanvasImageDestLocation {
let dest_size = dest_location.size().unwrap_or(src_location.size()); let dest_size = dest_location.size().unwrap_or(src_location.size());
let scale = dest_size / 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 transform = Transform2F::from_scale(scale).translate(offset);
let pattern = image.to_pattern(self, transform); let pattern = image.to_pattern(self, transform);