From 36e3b75cab8114e423544b79a8e2df353880f43b Mon Sep 17 00:00:00 2001 From: tamaina Date: Wed, 17 May 2023 07:54:46 +0000 Subject: [PATCH] wip --- packages/frontend/src/components/MkImgWithBlurhash.vue | 2 ++ packages/frontend/src/workers/draw-blurhash.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/components/MkImgWithBlurhash.vue b/packages/frontend/src/components/MkImgWithBlurhash.vue index e511212189..046d917300 100644 --- a/packages/frontend/src/components/MkImgWithBlurhash.vue +++ b/packages/frontend/src/components/MkImgWithBlurhash.vue @@ -136,6 +136,8 @@ async function draw() { worker.postMessage({ id: viewId, hash: props.hash, + width: canvasWidth, + height: canvasHeight, }); } else { try { diff --git a/packages/frontend/src/workers/draw-blurhash.ts b/packages/frontend/src/workers/draw-blurhash.ts index f5bb7f9716..984524389a 100644 --- a/packages/frontend/src/workers/draw-blurhash.ts +++ b/packages/frontend/src/workers/draw-blurhash.ts @@ -8,7 +8,7 @@ onmessage = async (event) => { if (!('hash' in event.data && typeof event.data.hash === 'string')) { return; } - const work = new OffscreenCanvas(canvas.width, canvas.height); + const work = new OffscreenCanvas(event.data.width ?? 64, event.data.height ?? 64); render(event.data.hash, work); const bitmap = await createImageBitmap(work); postMessage({ id: event.data.id, bitmap });