avoids repeated creation of shaderVars object

This commit is contained in:
Francisco Dans 2015-05-06 12:39:26 +02:00
parent ad9f7c40b1
commit de5ad67a38
2 changed files with 2 additions and 11 deletions

View File

@ -9,20 +9,10 @@ JS_CLIENT_FILES= lib/torque/*.js \
lib/torque/leaflet/canvas_layer.js \
lib/torque/leaflet/torque.js
all: dist/torque.js dist/torque.full.js
dist/torque.full.uncompressed.js: dist_folder dist/torque.uncompressed.js
$(BROWSERIFY) lib/torque/index.js --standalone torque > dist/torque.full.uncompressed.js
dist/torque.full.js: dist_folder dist/torque.full.uncompressed.js
$(UGLIFYJS) dist/torque.full.uncompressed.js > dist/torque.full.js
dist/torque.uncompressed.js: dist_folder $(JS_CLIENT_FILES)
$(BROWSERIFY) lib/torque/index.js --no-bundle-external --standalone torque > dist/torque.uncompressed.js
dist/torque.js: dist_folder dist/torque.uncompressed.js
$(UGLIFYJS) dist/torque.uncompressed.js > dist/torque.js
dist_folder:
mkdir -p dist

View File

@ -243,6 +243,7 @@ var Filters = require('./torque_filters');
_renderTile: function(tile, key, frame_offset, sprites, shader, shaderVars) {
if (!this._canvas) return;
shaderVars = shaderVars || { zoom: tile.z, 'frame-offset': frame_offset };
var prof = Profiler.metric('torque.renderer.point.renderTile').start();
var ctx = this._ctx;
var blendMode = compop2canvas(shader.eval('comp-op')) || this.options.blendmode;
@ -264,7 +265,7 @@ var Filters = require('./torque_filters');
if (c) {
var sp = sprites[c];
if (sp === undefined) {
sp = sprites[c] = this.generateSprite(shader, c, torque.extend({ zoom: tile.z, 'frame-offset': frame_offset }, shaderVars));
sp = sprites[c] = this.generateSprite(shader, c, shaderVars);
}
if (sp) {
var x = tile.x[posIdx]- (sp.width >> 1) + anchor;