Skip to content
Browse files

minor fixes

  • Loading branch information...
1 parent 20244b9 commit 8d7cfff15a96762ba9a2efbcc7720be234634873 @mental committed
Showing with 6 additions and 5 deletions.
  1. +6 −5 lib/retrograph.js
View
11 lib/retrograph.js
@@ -115,23 +115,24 @@ var Retrograph = (function () {
cb(this);
}
this._renderScanlines(RETROGRAPH_DISPLAY_HEIGHT);
+ checkError(this._vdu);
this._ctx.putImageData(this._imageData, 0, 0);
};
VDU.prototype.waitScanlines = function (numScanlines) {
- this._renderScanlines(numScanlines);
+ this._renderScanlines(Math.max(0, numScanlines);
};
VDU.prototype._renderScanlines = function (numScanlines) {
- var endScanline = Math.max(RETROGRAPH_DISPLAY_HEIGHT, this._currentScanline + numScanlines);
+ var endScanline = Math.min(RETROGRAPH_DISPLAY_HEIGHT, this._currentScanline + numScanlines);
for (; this._currentScanline < endScanline; this._currentScanline++) {
retrograph_render_scanline(this._vdu, this._transferBuffer, TRANSFER_BUFFER_SIZE);
+ var srcArray = Module.HEAP8;
+ var destArray = this._imageData.data;
var srcOffset = this._transferBuffer;
var destOffset = this._currentScanline + this._imageData.width * 4;
- var heapArray = Module.HEAP8;
- var imageArray = this._imageData.data;
for (var i = 0; i < RETROGRAPH_DISPLAY_WIDTH; i++) {
- imageArray[destOffset] = heapArray[srcOffset+i];
+ destArray[destOffset+i] = srcArray[srcOffset+i];
}
}
};

0 comments on commit 8d7cfff

Please sign in to comment.
Something went wrong with that request. Please try again.