diff --git a/src/jquery.qrcode.js b/src/jquery.qrcode.js index 484bae8..cfd8bfe 100644 --- a/src/jquery.qrcode.js +++ b/src/jquery.qrcode.js @@ -34,8 +34,10 @@ // draw in the canvas for( var row = 0; row < qrcode.getModuleCount(); row++ ){ for( var col = 0; col < qrcode.getModuleCount(); col++ ){ - ctx.fillStyle = qrcode.isDark(row, col) ? "#000000" : "#ffffff"; - ctx.fillRect( col*tileW, row*tileH, tileW, tileH ); + ctx.fillStyle = qrcode.isDark(row, col) ? options.foreground : options.background; + 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