Skip to content

Commit 68146db

Browse files
authored
use image bitmap instead of image data (#1878)
1 parent 5d59c43 commit 68146db

File tree

1 file changed

+3
-4
lines changed
  • apps/typegpu-docs/src/examples/rendering/jelly-slider

1 file changed

+3
-4
lines changed

apps/typegpu-docs/src/examples/rendering/jelly-slider/numbers.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class NumberProvider {
4444
ctx.textBaseline = 'middle';
4545
ctx.fillStyle = 'white';
4646

47-
const percentageImages = [];
47+
const percentageImages: ImageBitmap[] = [];
4848

4949
for (let i = 0; i <= 100; i++) {
5050
ctx.clearRect(0, 0, PERCENTAGE_WIDTH, PERCENTAGE_HEIGHT);
@@ -58,9 +58,8 @@ export class NumberProvider {
5858
ctx.font = percentageFont;
5959
ctx.fillText(`%`, x, y + 10);
6060

61-
percentageImages.push(
62-
ctx.getImageData(0, 0, PERCENTAGE_WIDTH, PERCENTAGE_HEIGHT),
63-
);
61+
const bitmap = await createImageBitmap(canvas);
62+
percentageImages.push(bitmap);
6463
}
6564

6665
this.digitTextureAtlas.write(percentageImages);

0 commit comments

Comments
 (0)