Refactorings (#65)

* Refactorings

* Responding to feedback
This commit is contained in:
Jake Archibald
2018-07-01 16:01:42 +01:00
committed by GitHub
parent cc3ed168d8
commit 9add650b75
3 changed files with 75 additions and 50 deletions

View File

@@ -44,9 +44,9 @@ export async function bitmapToImageData(bitmap: ImageBitmap): Promise<ImageData>
}
/** Replace the contents of a canvas with the given bitmap */
export function drawBitmapToCanvas(canvas: HTMLCanvasElement, img: ImageBitmap) {
export function drawBitmapToCanvas(canvas: HTMLCanvasElement, bitmap: ImageBitmap) {
const ctx = canvas.getContext('2d');
if (!ctx) throw Error('Canvas not initialized');
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(img, 0, 0);
ctx.drawImage(bitmap, 0, 0);
}