Automattic / Automattic/node-canvas
`drawImage` doesn't render properly when the context has both a scale and a shadow
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 1.2k
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 1
Description
## Issue
`drawImage` doesn't render properly when the context has both a scale and a shadow
The shadow itself is not scaled properly.
Bisecting points to:
https://github.com/Automattic/node-canvas/pull/1243/files
## Steps to Reproduce
```js
var Canvas = require('canvas');
// Draw an image.
var image = Canvas.createCanvas();
image.width = image.height = 200;
var ctx = image.getContext('2d');
ctx.fillRect(20, 20, 160, 160);
// Use this image in a *scaled* context with a shadow.
var scaled = Canvas.createCanvas();
scaled.width = scaled.height = 400;
ctx = scaled.getContext('2d');
ctx.scale(2, 2);
ctx.translate(50, 50);
ctx.shadowColor = "red";
ctx.shadowOffsetY = 2;
ctx.drawImage(image, 0, 0, image.width / 2, image.height / 2);
console.log(scaled.toDataURL());
```
## Your Environment
Result with canvas@2.4.1

Result starting canvas@2.5.0

(Tested on macOS)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.