mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-02-04 15:14:45 +00:00
update tng.
This commit is contained in:
parent
78fad856b6
commit
ea8c671251
39
vendor/tng.js
vendored
39
vendor/tng.js
vendored
@ -889,25 +889,18 @@ PNG.prototype.compileFrames_locpu = function(frames) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PNG.prototype.renderFrame = function(bmp, frame, i) {
|
PNG.prototype.renderFrame = function(bmp, frame, i) {
|
||||||
var renderBmp = bmp
|
var first = this.frames[0]
|
||||||
, first = this.frames[0]
|
|
||||||
, last = this.frames[i - 1]
|
, last = this.frames[i - 1]
|
||||||
, fc = frame.fctl
|
, fc = frame.fctl
|
||||||
, xo = fc.xOffset
|
, xo = fc.xOffset
|
||||||
, yo = fc.yOffset
|
, yo = fc.yOffset
|
||||||
, lxo
|
, lxo
|
||||||
, lyo
|
, lyo
|
||||||
, ops
|
|
||||||
, x
|
, x
|
||||||
, y
|
, y
|
||||||
, line
|
, line
|
||||||
, p;
|
, p;
|
||||||
|
|
||||||
ops = (xo + yo + fc.blendOp)
|
|
||||||
+ (last ? last.fctl.disposeOp : 0)
|
|
||||||
+ ~~(fc.width !== first.fctl.width)
|
|
||||||
+ ~~(fc.height !== first.fctl.height);
|
|
||||||
|
|
||||||
if (!this._curBmp) {
|
if (!this._curBmp) {
|
||||||
this._curBmp = [];
|
this._curBmp = [];
|
||||||
for (y = 0; y < first.fctl.height; y++) {
|
for (y = 0; y < first.fctl.height; y++) {
|
||||||
@ -920,39 +913,51 @@ PNG.prototype.renderFrame = function(bmp, frame, i) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (last && ops) {
|
if (last && last.fctl.disposeOp !== 0) {
|
||||||
if (last.fctl.disposeOp) {
|
|
||||||
lxo = last.fctl.xOffset;
|
lxo = last.fctl.xOffset;
|
||||||
lyo = last.fctl.yOffset;
|
lyo = last.fctl.yOffset;
|
||||||
for (y = 0; y < last.fctl.height; y++) {
|
for (y = 0; y < last.fctl.height; y++) {
|
||||||
for (x = 0; x < last.fctl.width; x++) {
|
for (x = 0; x < last.fctl.width; x++) {
|
||||||
if (last.fctl.disposeOp === 1) {
|
if (last.fctl.disposeOp === 0) {
|
||||||
|
// none / keep
|
||||||
|
} else if (last.fctl.disposeOp === 1) {
|
||||||
|
// background / clear
|
||||||
this._curBmp[lyo + y][lxo + x] = { r: 0, g: 0, b: 0, a: 0 };
|
this._curBmp[lyo + y][lxo + x] = { r: 0, g: 0, b: 0, a: 0 };
|
||||||
} else if (last.fctl.disposeOp === 2) {
|
} else if (last.fctl.disposeOp === 2) {
|
||||||
|
// previous / restore
|
||||||
p = this._lastBmp[y][x];
|
p = this._lastBmp[y][x];
|
||||||
this._curBmp[lyo + y][lxo + x] = { r: p.r, g: p.g, b: p.b, a: p.a };
|
this._curBmp[lyo + y][lxo + x] = { r: p.r, g: p.g, b: p.b, a: p.a };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
for (y = 0; y < frame.fctl.height; y++) {
|
for (y = 0; y < frame.fctl.height; y++) {
|
||||||
for (x = 0; x < frame.fctl.width; x++) {
|
for (x = 0; x < frame.fctl.width; x++) {
|
||||||
p = bmp[y][x];
|
p = bmp[y][x];
|
||||||
if (fc.blendOp === 0) {
|
if (fc.blendOp === 0) {
|
||||||
|
// source
|
||||||
this._curBmp[yo + y][xo + x] = { r: p.r, g: p.g, b: p.b, a: p.a };
|
this._curBmp[yo + y][xo + x] = { r: p.r, g: p.g, b: p.b, a: p.a };
|
||||||
} else if (fc.blendOp === 1) {
|
} else if (fc.blendOp === 1) {
|
||||||
if (bmp[y][x].a !== 0) {
|
// over
|
||||||
|
if (p.a !== 0) {
|
||||||
this._curBmp[yo + y][xo + x] = { r: p.r, g: p.g, b: p.b, a: p.a };
|
this._curBmp[yo + y][xo + x] = { r: p.r, g: p.g, b: p.b, a: p.a };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
renderBmp = this._curBmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._lastBmp = bmp;
|
return this._curBmp;
|
||||||
|
|
||||||
return renderBmp;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PNG.prototype._animate = function(callback) {
|
PNG.prototype._animate = function(callback) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user