Automattic / Automattic/node-canvas
ctx.scale with one or both parameters equal to zero silently and completely breaks the canvas
Open
Bug
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 1.2k
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 1
Description
``` js
var Canvas = require('canvas')
var c = new Canvas(1, 1)
var ctx = c.getContext('2d')
ctx.save()
ctx.scale(1, 0) // breaks here
ctx.restore()
// let's try to draw something
ctx.fillStyle = 'lime'
ctx.fillRect(0, 0, 1, 1)
// check if the image actually changed
if (ctx.getImageData(0, 0, 1, 1).data[1] == 255) {
console.log('pass')
} else console.log('fail')
```
Any operations that modify the canvas after the rogue `scale` operation produce no effect.
Versions: node-canvas 1.3.6, cairo both 1.10.2 (on Windows) and 1.14.0 (on Linux).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.