small refactor

This commit is contained in:
javi 2015-11-17 11:14:58 +01:00
parent c500a9c025
commit f399acb8cc

View File

@ -110,11 +110,19 @@ var Filters = require('./torque_filters');
// generate sprite based on cartocss style // generate sprite based on cartocss style
// //
generateSprite: function(shader, value, shaderVars) { generateSprite: function(shader, value, shaderVars) {
var self = this;
var prof = Profiler.metric('torque.renderer.point.generateSprite').start(); var prof = Profiler.metric('torque.renderer.point.generateSprite').start();
var st = shader.getStyle({ var st = shader.getStyle({
value: value value: value
}, shaderVars); }, shaderVars);
var ret = this.generateSpriteForStyle(st);
prof.end(true);
return ret;
},
generateSpriteForStyle: function(st) {
var self = this;
if(this._style === null || this._style !== st){ if(this._style === null || this._style !== st){
this._style = st; this._style = st;
} }
@ -159,7 +167,6 @@ var Filters = require('./torque_filters');
cartocss.renderPoint(ctx, st); cartocss.renderPoint(ctx, st);
} }
} }
prof.end(true);
if (torque.flags.sprites_to_images) { if (torque.flags.sprites_to_images) {
var i = this._createImage(); var i = this._createImage();
i.src = canvas.toDataURL(); i.src = canvas.toDataURL();