From 1d05e3d265a03b00f621b5d1769196dd3e74a397 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 18 Jul 2015 15:18:57 -0700 Subject: [PATCH] optimize tng for disposeOp=2. --- vendor/tng.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/vendor/tng.js b/vendor/tng.js index 99ff65f..731ef6c 100644 --- a/vendor/tng.js +++ b/vendor/tng.js @@ -932,14 +932,18 @@ PNG.prototype.renderFrame = function(bmp, frame, i) { } } - this._lastBmp = []; - for (y = 0; y < frame.fctl.height; y++) { - line = []; - for (x = 0; x < frame.fctl.width; x++) { - p = this._curBmp[yo + y][xo + x]; - line.push({ r: p.r, g: p.g, b: p.b, a: p.a }); + if (frame.fctl.disposeOp === 2) { + this._lastBmp = []; + for (y = 0; y < frame.fctl.height; y++) { + line = []; + for (x = 0; x < frame.fctl.width; x++) { + p = this._curBmp[yo + y][xo + x]; + line.push({ r: p.r, g: p.g, b: p.b, a: p.a }); + } + this._lastBmp.push(line); } - this._lastBmp.push(line); + } else { + this._lastBmp = null; } for (y = 0; y < frame.fctl.height; y++) {