mirror of
https://github.com/status-im/react-native-qrcode.git
synced 2025-02-09 00:54:09 +00:00
Merge pull request #8 from fanwashere/master
Fix rounding issue causing border-like artifacts.
This commit is contained in:
commit
9b504804ed
@ -25,8 +25,8 @@ function renderCanvas(canvas) {
|
|||||||
cells.forEach(function(row, rowIndex) {
|
cells.forEach(function(row, rowIndex) {
|
||||||
row.forEach(function(column, columnIndex) {
|
row.forEach(function(column, columnIndex) {
|
||||||
ctx.fillStyle = column ? bgColor : fgColor;
|
ctx.fillStyle = column ? bgColor : fgColor;
|
||||||
var w = Math.ceil((rowIndex + 1) * cellWidth) - Math.floor(rowIndex * cellWidth);
|
var w = Math.round((rowIndex + 1) * cellWidth) - Math.round(rowIndex * cellWidth);
|
||||||
var h = Math.ceil((columnIndex + 1) * cellHeight) - Math.floor(columnIndex * cellHeight);
|
var h = Math.round((columnIndex + 1) * cellHeight) - Math.round(columnIndex * cellHeight);
|
||||||
ctx.fillRect(Math.round(rowIndex * cellWidth), Math.round(columnIndex * cellHeight), w, h);
|
ctx.fillRect(Math.round(rowIndex * cellWidth), Math.round(columnIndex * cellHeight), w, h);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user