Skip to content

Commit 47d2c2d

Browse files
optimise: fill QRCode with one colour (#626)
1 parent 4a10c16 commit 47d2c2d

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

QRCoder/QRCode.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public Bitmap GetGraphic(int pixelsPerModule, Color darkColor, Color lightColor,
6262
using (var lightBrush = new SolidBrush(lightColor))
6363
using (var darkBrush = new SolidBrush(darkColor))
6464
{
65+
gfx.FillRectangle(lightBrush, new Rectangle(0, 0, bmp.Width, bmp.Height));
6566
for (var x = 0; x < size + offset; x += pixelsPerModule)
6667
{
6768
for (var y = 0; y < size + offset; y += pixelsPerModule)
@@ -72,10 +73,6 @@ public Bitmap GetGraphic(int pixelsPerModule, Color darkColor, Color lightColor,
7273
{
7374
gfx.FillRectangle(darkBrush, new Rectangle(x - offset, y - offset, pixelsPerModule, pixelsPerModule));
7475
}
75-
else
76-
{
77-
gfx.FillRectangle(lightBrush, new Rectangle(x - offset, y - offset, pixelsPerModule, pixelsPerModule));
78-
}
7976
}
8077
}
8178

0 commit comments

Comments
 (0)