fixed point renderer with resolution != 1

This commit is contained in:
javi 2013-09-27 13:34:46 +02:00
parent 60e34ba105
commit 9e54881d2a

View File

@ -104,7 +104,7 @@
if(!this._canvas) return;
var prof = Profiler.metric('PointRenderer:renderTile').start();
var ctx = this._ctx;
var res = this.options.resolution;
//var res = 1;//this.options.resolution;
var activePixels = tile.timeCount[key];
if(this.options.blendmode) {
ctx.globalCompositeOperation = this.options.blendmode;
@ -119,8 +119,10 @@
if(!sp) {
sp = sprites[c] = this.generateSprite(shader, c, _.extend({ zoom: tile.zoom, 'frame-offset': frame_offset }, shaderVars));
}
var x = tile.x[posIdx]*res - (sp.width >> 1);
var y = (256 - res - res*tile.y[posIdx]) - (sp.height >> 1);
//var x = tile.x[posIdx]*res - (sp.width >> 1);
//var y = (256 - res - res*tile.y[posIdx]) - (sp.height >> 1);
var x = tile.x[posIdx]- (sp.width >> 1);
var y = (256 - 1 - tile.y[posIdx]) - (sp.height >> 1);
ctx.drawImage(sp, x, y);
}
}