perf: MkImgWithBlurhashとMkMediaImageを最適化 (#10782)
* #10781 * fix tsconfig * fetch image?? * Revert "fetch image??" This reverts commit0925c28d5a
. * wip * Revert "wip" This reverts commitbe97c6cb88
. * loading="eager" * loading="eager" 2 * error * wip * wip * wip * wip * clean up * fix * 生成するworkerを1つにする? * clean up * use buraha * wip * smaller width, height * update buraha * clean up * fix * Update MkMediaImage.vue * Update MkImgWithBlurhash.vue * Revert "fix(frontend): センシティブ設定された画像を開くとき一瞬レイアウトが崩れる問題を修正" This reverts commit41e9aa6f9b
. * Update MkMediaList.vue * Update MkMediaList.vue * Update MkMediaList.vue * Update CHANGELOG.md * wait for decode * fix * ? * (test) remove container-type: inline-size; * Revert "(test) remove container-type: inline-size;" This reverts commit9448e64228
. * container-name * Revert "container-name" This reverts commit94385d3221
. * width: 100%; * improve performance * refactor * wip * WIP * wip * Revert "wip" This reverts commit36e3b75cab
. * Revert "WIP" This reverts commit05b729ef91
. * Revert "wip" This reverts commit0801e79361
. * #10860 * wip * no worker * Revert "no worker" This reverts commita9c49e4fb4
. * ✌️ * workerNumber固定は不要 --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
15
packages/frontend/src/workers/draw-blurhash.ts
Normal file
15
packages/frontend/src/workers/draw-blurhash.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { render } from 'buraha';
|
||||
|
||||
onmessage = (event) => {
|
||||
// console.log(event.data);
|
||||
if (!('id' in event.data && typeof event.data.id === 'string')) {
|
||||
return;
|
||||
}
|
||||
if (!('hash' in event.data && typeof event.data.hash === 'string')) {
|
||||
return;
|
||||
}
|
||||
const work = new OffscreenCanvas(event.data.width ?? 64, event.data.height ?? 64);
|
||||
render(event.data.hash, work);
|
||||
const bitmap = work.transferToImageBitmap();
|
||||
postMessage({ id: event.data.id, bitmap });
|
||||
};
|
7
packages/frontend/src/workers/test-webgl2.ts
Normal file
7
packages/frontend/src/workers/test-webgl2.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
const canvas = new OffscreenCanvas(1, 1);
|
||||
const gl = canvas.getContext('webgl2');
|
||||
if (gl) {
|
||||
postMessage({ result: true });
|
||||
} else {
|
||||
postMessage({ result: false });
|
||||
}
|
5
packages/frontend/src/workers/tsconfig.json
Normal file
5
packages/frontend/src/workers/tsconfig.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["esnext", "webworker"],
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user