From c514fd5e1c74889b3db397dd3987f3e91067b350 Mon Sep 17 00:00:00 2001 From: Mike Tinglof Date: Sun, 29 Jan 2012 02:10:25 -0500 Subject: [PATCH] don't need to copy palette data until we have all data for rect; change a few comments --- include/rfb.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/include/rfb.js b/include/rfb.js index 3ccd73a4..ba94fd99 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -1315,11 +1315,8 @@ encHandlers.TIGHT = function display_tight() { var numColors = rQ[rQi + 2] + 1; var paletteSize = numColors * fb_depth; FBU.bytes += paletteSize; - if (ws.rQwait("TIGHT palette " + cmode, FBU.bytes)) { return false; } - FBU.palette = ws.rQslice(3, 3 + paletteSize); - var bpp = (numColors <= 2) ? 1 : 8; var rowSize = Math.floor((FBU.width * bpp + 7) / 8); var raw = false; @@ -1333,14 +1330,16 @@ encHandlers.TIGHT = function display_tight() { if (ws.rQwait("TIGHT " + cmode, FBU.bytes)) { return false; } // Shift ctl, filter id, num colors, palette entries, and clength off - ws.rQshiftBytes(3 + paletteSize + clength[0]); + ws.rQshiftBytes(3); + FBU.palette = ws.rQshiftBytes(paletteSize); + ws.rQshiftBytes(clength[0]); - // Decompress data if (raw) data = ws.rQshiftBytes(clength[1]); else data = decompress(ws.rQshiftBytes(clength[1])); + // Convert indexed (palette based) image data to RGB var dest = []; var x, y, b; if (numColors == 2) { @@ -1395,10 +1394,12 @@ encHandlers.TIGHT = function display_tight() { } else clength = getCLength(ws.rQslice(1, 4)); - FBU.bytes = 1 + clength[0] + clength[1]; // ctl + clength size + zlib-data + FBU.bytes = 1 + clength[0] + clength[1]; if (ws.rQwait("TIGHT " + cmode, FBU.bytes)) { return false; } - ws.rQshiftBytes(1 + clength[0]); // ctl + clength + // Shift ctl, clength off + ws.rQshiftBytes(1 + clength[0]); + if (raw) data = ws.rQshiftBytes(clength[1]); else