From 7b7a5e4a6b8bf02f10f7dd94e8234c235289a7e4 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Sat, 10 Sep 2016 11:51:19 -0700 Subject: [PATCH] Force pixel bounds to integers --- hires.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hires.js b/hires.js index 27095d1..1133e11 100644 --- a/hires.js +++ b/hires.js @@ -9,7 +9,7 @@ // Usage: // -// var hires = new LoRes( element, width, height ) +// var hires = new HiRes( element, width, height ) // hires.clear( [color_index] ) // hires.setColor( color_index ) // hires.plot( x, y ) @@ -69,7 +69,7 @@ function HiRes(element, width, height) { function drawPixel(x, y) { var sx = element.width / width, sy = element.height / height; - context.fillRect(x * sx, y * sy, sx, sy); + context.fillRect((x * sx)|0, (y * sy)|0, sx|0, sy|0); pixels[x + y * width] = color; }