Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix pixel copy

  • Loading branch information...
commit 7feed89240a1c55122449631e8ea56f6504001be 1 parent 1eade30
@mental authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 src/js/retrograph.tmpl.js
View
11 src/js/retrograph.tmpl.js
@@ -14,7 +14,7 @@ var Retrograph = (function () {
var RETROGRAPH_DISPLAY_WIDTH = 256;
var RETROGRAPH_DISPLAY_HEIGHT = 224;
- var RETROGRAPH_BYTES_PER_PIXEL = 8;
+ var RETROGRAPH_BYTES_PER_PIXEL = 4;
var RETROGRAPH_OK = 0;
var RETROGRAPH_NO_MEMORY = 1;
@@ -29,7 +29,8 @@ var Retrograph = (function () {
var retrograph_begin_frame = cfunc('retrograph_begin_frame', 1);
var retrograph_render_scanline = cfunc('retrograph_render_scanline', 3);
- var TRANSFER_BUFFER_SIZE = RETROGRAPH_BYTES_PER_PIXEL * RETROGRAPH_DISPLAY_WIDTH;
+ var DISPLAY_BYTE_WIDTH = RETROGRAPH_BYTES_PER_PIXEL * RETROGRAPH_DISPLAY_WIDTH;
+ var TRANSFER_BUFFER_SIZE = DISPLAY_BYTE_WIDTH;
function checkError(vdu) {
switch (retrograph_get_error(vdu)) {
@@ -119,9 +120,9 @@ var Retrograph = (function () {
var srcArray = Module.HEAP8;
var destArray = this._imageData.data;
var srcOffset = this._transferBuffer;
- var destOffset = this._currentScanline + RETROGRAPH_DISPLAY_WIDTH * 4;
- for (var i = 0; i < RETROGRAPH_DISPLAY_WIDTH; i++) {
- destArray[destOffset+i] = srcArray[srcOffset+i];
+ var destOffset = this._currentScanline * DISPLAY_BYTE_WIDTH;
+ for (var i = 0; i < DISPLAY_BYTE_WIDTH; i++) {
+ destArray[destOffset+i] = srcArray[srcOffset+i] & 0xff;
}
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.