Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Ensure the tile width and height values are integers. #14

Open
wants to merge 1 commit into from

2 participants

@gorbster

This should address the issue here:

#7

Currently, if the specified width / number of calculated modules is a non-integer value, fillRect() will attempt a sub-pixel draw resulting in artifacts between the rendered tiles.

By flooring the tile width and height, this problem should be alleviated.

@jeromeetienne

can you give some values for me to reproduce this issue ?

@gorbster

The barcode strings I'm working with are about 20 characters long, and I see the artifacts when I try rendering anything with a larger size of 200px.

I see this in Chrome, Safari, and Mobile Safari. Here's what it looks like in Chrome:

http://cl.ly/1y1Q2U01240n3U0K0l37

And here are the parameters I used:

    jQuery('#qrcode').qrcode({
        render  : "canvas",
        text    : "12345678901234567890",
        width   : 400,
        height  : 400
    }); 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 3, 2011
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/jquery.qrcode.js
View
4 src/jquery.qrcode.js
@@ -28,8 +28,8 @@
var ctx = canvas.getContext('2d');
// compute tileW/tileH based on options.width/options.height
- var tileW = options.width / qrcode.getModuleCount();
- var tileH = options.height / qrcode.getModuleCount();
+ var tileW = Math.floor(options.width / qrcode.getModuleCount());
+ var tileH = Math.floor(options.height / qrcode.getModuleCount());
// draw in the canvas
for( var row = 0; row < qrcode.getModuleCount(); row++ ){
Something went wrong with that request. Please try again.