Skip to content

Commit 4be11d9

Browse files
feat(renderer): enhance background fill configuration and effect validation
1 parent f314703 commit 4be11d9

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,6 @@
6767
"*": true,
6868
"plaintext": true,
6969
"markdown": true
70-
}
70+
},
71+
"chat.agent.maxRequests": 500
7172
}

src/js/visuals/Renderer.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ class Renderer {
7575
if (ctx) {
7676
ctx.imageSmoothingEnabled = settings.rendering.imageSmoothingEnabled;
7777
ctx.imageSmoothingQuality = settings.rendering.imageSmoothingQuality;
78+
// Pre-configure background fill to avoid changing style each frame
79+
ctx.fillStyle = settings.rendering.backgroundColor;
7880
}
7981
return { canvas, ctx };
8082
}
@@ -307,6 +309,10 @@ class Renderer {
307309
// console.log('applyEffects start data[0]=', data && data[0]);
308310

309311
for (const effect of effects) {
312+
// Validate note when effect requires it
313+
if ((effect.type === 'split' || effect.type === 'mirror' || effect.type === 'offset' || effect.type === 'color') && typeof effect.note !== 'number') {
314+
continue; // malformed effect entry
315+
}
310316
const intensity = effect.velocity / 127; // Normalize to 0-1
311317

312318
switch (effect.type) {
@@ -601,9 +607,7 @@ class Renderer {
601607
}
602608

603609
// Clear off-screen canvases
604-
this.#ctxA.fillStyle = settings.rendering.backgroundColor;
605610
this.#ctxA.fillRect(0, 0, this.#canvasWidth, this.#canvasHeight);
606-
this.#ctxB.fillStyle = settings.rendering.backgroundColor;
607611
this.#ctxB.fillRect(0, 0, this.#canvasWidth, this.#canvasHeight);
608612

609613
// Render Layer A

0 commit comments

Comments
 (0)