mirror of
https://github.com/inexorabletash/jsbasic.git
synced 2025-02-18 18:30:53 +00:00
Force pixel bounds to integers
This commit is contained in:
parent
c1034dcdff
commit
7b7a5e4a6b
4
hires.js
4
hires.js
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
// Usage:
|
// Usage:
|
||||||
//
|
//
|
||||||
// var hires = new LoRes( element, width, height )
|
// var hires = new HiRes( element, width, height )
|
||||||
// hires.clear( [color_index] )
|
// hires.clear( [color_index] )
|
||||||
// hires.setColor( color_index )
|
// hires.setColor( color_index )
|
||||||
// hires.plot( x, y )
|
// hires.plot( x, y )
|
||||||
@ -69,7 +69,7 @@ function HiRes(element, width, height) {
|
|||||||
function drawPixel(x, y) {
|
function drawPixel(x, y) {
|
||||||
var sx = element.width / width,
|
var sx = element.width / width,
|
||||||
sy = element.height / height;
|
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;
|
pixels[x + y * width] = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user