Removed unused methods from Frame

This commit is contained in:
jdescottes
2014-07-07 23:33:29 +02:00
parent b3bb2472f1
commit 4102e929f4
2 changed files with 6 additions and 36 deletions

View File

@@ -96,22 +96,18 @@
ns.Frame.prototype.getPixel = function (x, y) {
if (this.containsPixel(x, y)) {
return this._unsafeGetPixel(x,y);
return this.pixels[x][y];
} else {
return null;
}
};
ns.Frame.prototype._unsafeGetPixel = function (x, y) {
return this.pixels[x][y];
};
ns.Frame.prototype.forEachPixel = function (callback) {
var width = this.getWidth();
var height = this.getHeight();
for (var col = 0 ; col < width ; col++) {
for (var row = 0 ; row < height ; row++) {
callback(this._unsafeGetPixel(col, row), col, row, this);
for (var x = 0 ; x < width ; x++) {
for (var y = 0 ; y < height ; y++) {
callback(this.pixels[x][y], x, y, this);
}
}
};
@@ -128,29 +124,6 @@
return col >= 0 && row >= 0 && col < this.width && row < this.height;
};
ns.Frame.prototype.saveState = function () {
// remove all states past current state
this.previousStates.length = this.stateIndex + 1;
// push new state
this.previousStates.push(this.getPixels());
// set the stateIndex to latest saved state
this.stateIndex = this.previousStates.length - 1;
};
ns.Frame.prototype.loadPreviousState = function () {
if (this.stateIndex > 0) {
this.stateIndex--;
this.setPixels(this.previousStates[this.stateIndex]);
}
};
ns.Frame.prototype.loadNextState = function () {
if (this.stateIndex < this.previousStates.length - 1) {
this.stateIndex++;
this.setPixels(this.previousStates[this.stateIndex]);
}
};
ns.Frame.prototype.isSameSize = function (otherFrame) {
return this.getHeight() == otherFrame.getHeight() && this.getWidth() == otherFrame.getWidth();
};