Fixed gray lines in between blocks.

The distance between the highest point the next point can be and the
lowest point the current can be is calculated and then it fills from
the closest integer to the current point.

Conflicts:

	src/jquery.qrcode.js
This commit is contained in:
Bjarte Johansen 2012-03-26 12:47:00 +02:00
parent 77aa3c30cb
commit 386c0b4353

View file

@ -34,8 +34,10 @@
// draw in the canvas // draw in the canvas
for( var row = 0; row < qrcode.getModuleCount(); row++ ){ for( var row = 0; row < qrcode.getModuleCount(); row++ ){
for( var col = 0; col < qrcode.getModuleCount(); col++ ){ for( var col = 0; col < qrcode.getModuleCount(); col++ ){
ctx.fillStyle = qrcode.isDark(row, col) ? "#000000" : "#ffffff"; ctx.fillStyle = qrcode.isDark(row, col) ? options.foreground : options.background;
ctx.fillRect( col*tileW, row*tileH, tileW, tileH ); var w = (Math.ceil((col+1)*tileW) - Math.floor(col*tileW));
var h = (Math.ceil((row+1)*tileW) - Math.floor(row*tileW));
ctx.fillRect(Math.round(col*tileW),Math.round(row*tileH), w, h);
} }
} }
// return just built canvas // return just built canvas