Skip to content

Commit

Permalink
Clean up scaling in _drawFromImage
Browse files Browse the repository at this point in the history
  • Loading branch information
adroitwhiz committed Jan 7, 2021
1 parent f9ef76c commit e770e7a
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/svg-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,8 @@ class SvgRenderer {
this._cachedImage.naturalHeight <= 0
) return;
this._context.clearRect(0, 0, this._canvas.width, this._canvas.height);
this._context.scale(ratio, ratio);
this._context.setTransform(ratio, 0, 0, ratio, 0, 0);
this._context.drawImage(this._cachedImage, 0, 0);
// Reset the canvas transform after drawing.
this._context.setTransform(1, 0, 0, 1, 0, 0);
// Set the CSS style of the canvas to the actual measurements.
this._canvas.style.width = bbox.width;
this._canvas.style.height = bbox.height;
}
}

Expand Down

0 comments on commit e770e7a

Please sign in to comment.