conveys draw calls in flush method

This commit is contained in:
Francisco Dans 2015-02-25 12:47:55 +01:00
parent 8e8ae30dc8
commit 7f72ae01af
2 changed files with 10 additions and 3 deletions

View File

@ -161,16 +161,15 @@ BallRenderer.prototype = {
var neighbors = this.getNeighbors(i); var neighbors = this.getNeighbors(i);
for (var n = 0, ln = neighbors.length; n<ln; n++){ for (var n = 0, ln = neighbors.length; n<ln; n++){
var index = neighbors[n]; var index = neighbors[n];
if(this.contourLayer[index+3] === 0 || this.contourLayer[index+3]!==this.contourLayer[i+3]){ if(this.contourLayer[index+3] === 0 || this.contourLayer[index+3] !== this.contourLayer[i+3]){
this.isoplethLayer[index+3] = 255; this.isoplethLayer[index+3] = 255;
this.isoplethLayer[index] = this.contourLayer[index+3]; this.isoplethLayer[index] = this.contourLayer[index+3];
this.isoplethLayer[index+1] = this.contourLayer[index+3]; this.isoplethLayer[index+1] = this.contourLayer[index+3];
this.isoplethLayer[index+2] = this.contourLayer[index+3];
} }
} }
} }
} }
//this.invalidate();
this.draw(this.isoplethLayer);
}, },
colorize: function (pixels, gradient) { colorize: function (pixels, gradient) {
for (var i = 3, len = pixels.length, j; i < len; i += 4) { for (var i = 3, len = pixels.length, j; i < len; i += 4) {

View File

@ -395,6 +395,14 @@ var ballRenderer = require('./ball.js');
this._filters.draw(); this._filters.draw();
} }
} }
},
flush: function(){
this._ctx.setTransform(1, 0, 0, 1, 0, 0);
if(!this.ballRenderer) return;
this.ballRenderer.contour(8);
this.ballRenderer.isopleth();
this.ballRenderer.draw();
this.ballRenderer.invalidate();
} }
}); });