Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Fix buffer type casting for image and texture data

Richie McIlroyc95d4d052c8d
diff --git a/apps/desktop/src/utils/socket.ts b/apps/desktop/src/utils/socket.ts
index c4b8fe0d1..e0b503848 100644
--- a/apps/desktop/src/utils/socket.ts
+++ b/apps/desktop/src/utils/socket.ts
@@ -261,7 +261,11 @@ export function createImageDataWS(
directCanvas.height = height;
}
- const imageData = new ImageData(frameData, width, height);
+ const imageData = new ImageData(
+ frameData.buffer as unknown as ImageDataArray,
+ width,
+ height,
+ );
directCtx.putImageData(imageData, 0, 0);
if (!hasRenderedFrame()) {
diff --git a/apps/desktop/src/utils/webgpu-renderer.ts b/apps/desktop/src/utils/webgpu-renderer.ts
index bf98ac5e2..b97d3ba35 100644
--- a/apps/desktop/src/utils/webgpu-renderer.ts
+++ b/apps/desktop/src/utils/webgpu-renderer.ts
@@ -197,7 +197,7 @@ export function renderFrameWebGPU(
device.queue.writeTexture(
{ texture: renderer.frameTexture },
- textureData,
+ textureData.buffer as unknown as GPUAllowSharedBufferSource,
{ bytesPerRow: width * 4, rowsPerImage: height },
{ width, height },
);