Skip to content

Commit

Permalink
This doesn't need to be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jakearchibald committed Jun 28, 2018
1 parent d618310 commit 3ee32c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, img: ImageBitmap) {
const ctx = canvas.getContext('2d');
if (!ctx) throw Error('Canvas not initialized');
ctx.clearRect(0, 0, canvas.width, canvas.height);
if (img) ctx.drawImage(img, 0, 0);
ctx.drawImage(img, 0, 0);
}

0 comments on commit 3ee32c9

Please sign in to comment.