Standardize on camelCase in Decoders

pull/36/head
Samuel Mannehed 5 years ago committed by Lauri Kasanen
parent a3e2b1e46e
commit b2d8db3f7b

@ -17,10 +17,10 @@ export default class HextileDecoder {
decodeRect(x, y, width, height, sock, display, depth) { decodeRect(x, y, width, height, sock, display, depth) {
if (this._tiles === 0) { if (this._tiles === 0) {
this._tiles_x = Math.ceil(width / 16); this._tilesX = Math.ceil(width / 16);
this._tiles_y = Math.ceil(height / 16); this._tilesY = Math.ceil(height / 16);
this._total_tiles = this._tiles_x * this._tiles_y; this._totalTiles = this._tilesX * this._tilesY;
this._tiles = this._total_tiles; this._tiles = this._totalTiles;
} }
while (this._tiles > 0) { while (this._tiles > 0) {
@ -39,11 +39,11 @@ export default class HextileDecoder {
subencoding + ")"); subencoding + ")");
} }
const curr_tile = this._total_tiles - this._tiles; const currTile = this._totalTiles - this._tiles;
const tile_x = curr_tile % this._tiles_x; const tileX = currTile % this._tilesX;
const tile_y = Math.floor(curr_tile / this._tiles_x); const tileY = Math.floor(currTile / this._tilesX);
const tx = x + tile_x * 16; const tx = x + tileX * 16;
const ty = y + tile_y * 16; const ty = y + tileY * 16;
const tw = Math.min(16, (x + width) - tx); const tw = Math.min(16, (x + width) - tx);
const th = Math.min(16, (y + height) - ty); const th = Math.min(16, (y + height) - ty);

@ -24,15 +24,15 @@ export default class RawDecoder {
return false; return false;
} }
const cur_y = y + (height - this._lines); const curY = y + (height - this._lines);
const curr_height = Math.min(this._lines, const currHeight = Math.min(this._lines,
Math.floor(sock.rQlen / bytesPerLine)); Math.floor(sock.rQlen / bytesPerLine));
let data = sock.rQ; let data = sock.rQ;
let index = sock.rQi; let index = sock.rQi;
// Convert data if needed // Convert data if needed
if (depth == 8) { if (depth == 8) {
const pixels = width * curr_height; const pixels = width * currHeight;
const newdata = new Uint8Array(pixels * 4); const newdata = new Uint8Array(pixels * 4);
for (let i = 0; i < pixels; i++) { for (let i = 0; i < pixels; i++) {
newdata[i * 4 + 0] = ((data[index + i] >> 0) & 0x3) * 255 / 3; newdata[i * 4 + 0] = ((data[index + i] >> 0) & 0x3) * 255 / 3;
@ -44,9 +44,9 @@ export default class RawDecoder {
index = 0; index = 0;
} }
display.blitImage(x, cur_y, width, curr_height, data, index); display.blitImage(x, curY, width, currHeight, data, index);
sock.rQskipBytes(curr_height * bytesPerLine); sock.rQskipBytes(currHeight * bytesPerLine);
this._lines -= curr_height; this._lines -= currHeight;
if (this._lines > 0) { if (this._lines > 0) {
return false; return false;
} }

Loading…
Cancel
Save