Skip to content

Commit

Permalink
sim: fix rect boundscheck
Browse files Browse the repository at this point in the history
  • Loading branch information
JerwuQu committed May 13, 2024
1 parent 17781ae commit ba5d791
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions simulator/src/framebuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export class Framebuffer {
const startY = Math.max(0, y);
const endXUnclamped = x + width;
const endYUnclamped = y + height;
const endX = Math.min(endXUnclamped, WIDTH);
const endY = Math.min(endYUnclamped, HEIGHT);
const endX = Math.max(0, Math.min(endXUnclamped, WIDTH));
const endY = Math.max(0, Math.min(endYUnclamped, HEIGHT));

if (fillColor !== OPTIONAL_COLOR_NONE) {
for (let yy = startY; yy < endY; ++yy) {
Expand Down

0 comments on commit ba5d791

Please sign in to comment.