From 386c0b435306ea0f162319aa2ec62f05849b7beb Mon Sep 17 00:00:00 2001 From: Bjarte Johansen Date: Mon, 26 Mar 2012 12:47:00 +0200 Subject: [PATCH] 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 --- src/jquery.qrcode.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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