Rotation optimise. Fixes #362 (#363)

* Move early exit for no-rotation.

* lol this was meant to be 10 seconds.
This commit is contained in:
Jake Archibald
2018-12-09 07:11:11 +00:00
committed by GitHub
parent 7389c507fb
commit c2a305304b
3 changed files with 9 additions and 7 deletions

View File

@@ -4,10 +4,6 @@ const bpp = 4;
export function rotate(data: ImageData, opts: RotateOptions): ImageData {
const { rotate } = opts;
// Early exit if there's no transform.
if (rotate === 0) return data;
const flipDimensions = rotate % 180 !== 0;
const { width: inputWidth, height: inputHeight } = data;
const outputWidth = flipDimensions ? inputHeight : inputWidth;