Skip to content

Commit

Permalink
perf(module:qr-code): improved background drawing efficiency (#8543)
Browse files Browse the repository at this point in the history
  • Loading branch information
HyperLife1119 committed May 23, 2024
1 parent 65cbb4e commit db09bf7
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions components/qr-code/qrcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,8 @@ export function drawCanvasBackground(
scale: number,
backgroundColor: string
): void {
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
ctx.fillStyle = backgroundColor;
ctx.fillRect(x * scale, y * scale, scale, scale);
}
}
ctx.fillStyle = backgroundColor;
ctx.fillRect(0, 0, width * scale, height * scale);
}

export function formatPadding(padding: number | number[]): number[] {
Expand Down

0 comments on commit db09bf7

Please sign in to comment.