refactor. comments.

This commit is contained in:
Christopher Jeffrey 2013-07-14 11:58:44 -05:00
parent 5ebfb4835f
commit c9c01e0805

View File

@ -651,24 +651,22 @@ Screen.prototype.deleteTop = function(top, bottom) {
return this.deleteLine(1, top, top, bottom);
};
// Parse the sides of an element to determine
// whether an element has uniform cells on
// both sides. If it does, we can use CSR to
// optimize scrolling on a scrollable element.
// Not exactly sure how worthwile this is.
// This will cause a performance/cpu-usage hit,
// but will it be less or greater than the
// performance hit of slow-rendering scrollable
// boxes with clean sides?
Screen.prototype.cleanSides = function(el) {
if (!el._lastPos) {
var pos = el._lastPos;
if (!pos) {
return false;
}
var pos = el._lastPos
, yi = pos.yi + (el.border ? 1 : 0) + el.padding
, yl = pos.yl - (el.border ? 1 : 0) - el.padding
, first = this.olines[yi][pos.xi - 1]
, ch
, x
, y;
if (pos._cleanSides != null) {
return pos._cleanSides;
}
@ -677,6 +675,13 @@ Screen.prototype.cleanSides = function(el) {
return pos._cleanSides = true;
}
var yi = pos.yi + (el.border ? 1 : 0) + el.padding
, yl = pos.yl - (el.border ? 1 : 0) - el.padding
, first = this.olines[yi][pos.xi - 1]
, ch
, x
, y;
for (y = yi; y < yl; y++) {
for (x = pos.xi - 1; x >= 0; x--) {
ch = this.olines[y][x];
@ -867,7 +872,6 @@ Screen.prototype._reduceColor = function(col) {
if (this.tput) {
if (col >= 16 && this.tput.colors <= 16) {
col = colors.ccolors[col];
if (col == null) col = 0;
} else if (col >= 8 && this.tput.colors <= 8) {
col -= 8;
} else if (col >= 2 && this.tput.colors <= 2) {