Make a local variable of ctx

This commit is contained in:
Francisco López 2017-02-08 15:03:45 +01:00
parent b9442034ef
commit a53de47f2d

View File

@ -67,13 +67,13 @@ var Filters = require('./torque_filters');
var canvas = this._canvas; var canvas = this._canvas;
var color = this._Map['-torque-clear-color'] var color = this._Map['-torque-clear-color']
// shortcut for the default value // shortcut for the default value
var ctx = this._ctx;
if (color === "rgba(255, 255, 255, 0)" || !color) { if (color === "rgba(255, 255, 255, 0)" || !color) {
this._ctx.save(); ctx.save();
this._ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.setTransform(1, 0, 0, 1, 0, 0);
this._ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.clearRect(0, 0, canvas.width, canvas.height);
this._ctx.restore(); ctx.restore();
} else { } else {
var ctx = this._ctx;
ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.setTransform(1, 0, 0, 1, 0, 0);
var compop = this._Map['comp-op'] var compop = this._Map['comp-op']
ctx.globalCompositeOperation = compop2canvas(compop); ctx.globalCompositeOperation = compop2canvas(compop);