Skip to content

Commit 96ea409

Browse files
committed
Use willReadFrequently in a couple more places
1 parent 5b82081 commit 96ea409

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

frontend/src/components/panels/Document.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@
241241
`.trim();
242242
243243
if (!rasterizedCanvas) {
244-
rasterizedCanvas = await rasterizeSVGCanvas(svg, width * dpiFactor, height * dpiFactor, "image/png");
245-
rasterizedContext = rasterizedCanvas.getContext("2d") || undefined;
244+
rasterizedCanvas = await rasterizeSVGCanvas(svg, width * dpiFactor, height * dpiFactor);
245+
rasterizedContext = rasterizedCanvas.getContext("2d", { willReadFrequently: true }) || undefined;
246246
}
247247
if (!rasterizedContext) return undefined;
248248

frontend/src/utility-functions/rasterization.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export async function imageToCanvasContext(imageData: ImageBitmapSource): Promis
9393
canvas.width = width;
9494
canvas.height = height;
9595

96-
const context = canvas.getContext("2d");
96+
const context = canvas.getContext("2d", { willReadFrequently: true });
9797
if (!context) throw new Error("Could not create canvas context");
9898
context.drawImage(image, 0, 0, image.width, image.height, 0, 0, width, height);
9999

0 commit comments

Comments
 (0)