Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/src/components/panels/Document.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@
`.trim();

if (!rasterizedCanvas) {
rasterizedCanvas = await rasterizeSVGCanvas(svg, width * dpiFactor, height * dpiFactor, "image/png");
rasterizedContext = rasterizedCanvas.getContext("2d") || undefined;
rasterizedCanvas = await rasterizeSVGCanvas(svg, width * dpiFactor, height * dpiFactor);
rasterizedContext = rasterizedCanvas.getContext("2d", { willReadFrequently: true }) || undefined;
}
if (!rasterizedContext) return undefined;

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ export class Color {
const canvas = document.createElement("canvas");
canvas.width = 1;
canvas.height = 1;
const context = canvas.getContext("2d");
const context = canvas.getContext("2d", { willReadFrequently: true });
if (!context) return undefined;

context.clearRect(0, 0, 1, 1);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utility-functions/rasterization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export async function imageToCanvasContext(imageData: ImageBitmapSource): Promis
canvas.width = width;
canvas.height = height;

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

Expand Down
Loading