Automattic / Automattic/node-canvas

Restoring a saved state after setting transformation horizontal/vertical scaling to 0

Open
#1,852 0 comments 1 reaction 0 assignees View on GitHub
Bug
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

## Issue or Feature

Methods affected by the transformation matrix fail after:
- saving the current state
- setting at least one of the horizontal/vertical scaling in the transformation matrix to 0
- restoring the saved state

## Steps to Reproduce

```js
const {createCanvas} = require("canvas");

const canvas = createCanvas(100, 100);
const ctx = canvas.getContext("2d");

ctx.save();
ctx.setTransform(0, 0, 0, 0, 0, 0);
ctx.restore();

// canvas should be black but is still white
ctx.fillRect(0, 0, canvas.width, canvas.height);
```

## Your Environment
* node-canvas 2.8.0
* node 16.4.1 on Ubuntu 20.04.2

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.