Force pixel bounds to integers

This commit is contained in:
Joshua Bell 2016-09-10 11:51:19 -07:00
parent c1034dcdff
commit 7b7a5e4a6b

View File

@ -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;
}