From f399acb8cc95ebb679e162fe6123cd4ceaf2e513 Mon Sep 17 00:00:00 2001 From: javi Date: Tue, 17 Nov 2015 11:14:58 +0100 Subject: [PATCH] small refactor --- lib/torque/renderer/point.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/torque/renderer/point.js b/lib/torque/renderer/point.js index da6d687..13cd2bc 100644 --- a/lib/torque/renderer/point.js +++ b/lib/torque/renderer/point.js @@ -110,11 +110,19 @@ var Filters = require('./torque_filters'); // generate sprite based on cartocss style // generateSprite: function(shader, value, shaderVars) { - var self = this; var prof = Profiler.metric('torque.renderer.point.generateSprite').start(); var st = shader.getStyle({ value: value }, shaderVars); + + var ret = this.generateSpriteForStyle(st); + prof.end(true); + return ret; + }, + + generateSpriteForStyle: function(st) { + var self = this; + if(this._style === null || this._style !== st){ this._style = st; } @@ -159,7 +167,6 @@ var Filters = require('./torque_filters'); cartocss.renderPoint(ctx, st); } } - prof.end(true); if (torque.flags.sprites_to_images) { var i = this._createImage(); i.src = canvas.toDataURL();