Commit d67de767 authored by Joel Martin's avatar Joel Martin

Rename tightpng img queue variable to imgQ.

parent 3e7a7cef
...@@ -23,7 +23,7 @@ var that = {}, // Public API interface ...@@ -23,7 +23,7 @@ var that = {}, // Public API interface
pixelFormat, clientEncodings, fbUpdateRequest, pixelFormat, clientEncodings, fbUpdateRequest,
keyEvent, pointerEvent, clientCutText, keyEvent, pointerEvent, clientCutText,
extract_data_uri, scan_tight_imgs, extract_data_uri, scan_tight_imgQ,
send_array, checkEvents, // Overridable for testing send_array, checkEvents, // Overridable for testing
...@@ -62,15 +62,16 @@ var that = {}, // Public API interface ...@@ -62,15 +62,16 @@ var that = {}, // Public API interface
encHandlers = {}, encHandlers = {},
encNames = {}, encNames = {},
ws = null, // Web Socket object ws = null, // Web Socket object
canvas = null, // Canvas object canvas = null, // Canvas object
sendTimer = null, // Send Queue check timer sendTimer = null, // Send Queue check timer
msgTimer = null, // queued handle_message timer msgTimer = null, // queued handle_message timer
// Receive and send queues // Receive and send queues
rQ = [], // Receive Queue rQ = [], // Receive Queue
rQi = 0, // Receive Queue Index rQi = 0, // Receive Queue Index
sQ = "", // Send Queue rQmax = 100000, // Max size before compacting
sQ = "", // Send Queue
// Frame buffer update state // Frame buffer update state
FBU = { FBU = {
...@@ -86,7 +87,7 @@ var that = {}, // Public API interface ...@@ -86,7 +87,7 @@ var that = {}, // Public API interface
encoding : 0, encoding : 0,
subencoding : -1, subencoding : -1,
background : null, background : null,
imgs : [] // TIGHT_PNG image queue imgQ : [] // TIGHT_PNG image queue
}, },
fb_Bpp = 4, fb_Bpp = 4,
...@@ -98,10 +99,9 @@ var that = {}, // Public API interface ...@@ -98,10 +99,9 @@ var that = {}, // Public API interface
cuttext = 'none', // ServerCutText wait state cuttext = 'none', // ServerCutText wait state
cuttext_length = 0, cuttext_length = 0,
scan_imgs_rate = 100, scan_imgQ_rate = 100,
last_req_time = 0, last_req_time = 0,
rre_chunk_sz = 100, rre_chunk_sz = 100,
rQmaxlen = 100000,
timing = { timing = {
last_fbu : 0, last_fbu : 0,
...@@ -309,7 +309,7 @@ init_vars = function() { ...@@ -309,7 +309,7 @@ init_vars = function() {
FBU.subrects = 0; // RRE and HEXTILE FBU.subrects = 0; // RRE and HEXTILE
FBU.lines = 0; // RAW FBU.lines = 0; // RAW
FBU.tiles = 0; // HEXTILE FBU.tiles = 0; // HEXTILE
FBU.imgs = []; // TIGHT_PNG image queue FBU.imgQ = []; // TIGHT_PNG image queue
mouse_buttonMask = 0; mouse_buttonMask = 0;
mouse_arr = []; mouse_arr = [];
}; };
...@@ -490,7 +490,7 @@ function handle_message() { ...@@ -490,7 +490,7 @@ function handle_message() {
} }
} }
// Compact the queue // Compact the queue
if (rQ.length > rQmaxlen) { if (rQ.length > rQmax) {
//Util.Debug("Compacting receive queue"); //Util.Debug("Compacting receive queue");
rQ = rQ.slice(rQi); rQ = rQ.slice(rQi);
rQi = 0; rQi = 0;
...@@ -828,7 +828,7 @@ init_msg = function() { ...@@ -828,7 +828,7 @@ init_msg = function() {
/* Start pushing/polling */ /* Start pushing/polling */
setTimeout(checkEvents, conf.check_rate); setTimeout(checkEvents, conf.check_rate);
setTimeout(scan_tight_imgs, scan_imgs_rate); setTimeout(scan_tight_imgQ, scan_imgQ_rate);
if (conf.encrypt) { if (conf.encrypt) {
updateState('normal', "Connected (encrypted) to: " + fb_name); updateState('normal', "Connected (encrypted) to: " + fb_name);
...@@ -1323,8 +1323,8 @@ encHandlers.TIGHT_PNG = function display_tight_png() { ...@@ -1323,8 +1323,8 @@ encHandlers.TIGHT_PNG = function display_tight_png() {
//Util.Debug(" png, rQlen(): " + rQlen() + ", clength[0]: " + clength[0] + ", clength[1]: " + clength[1]); //Util.Debug(" png, rQlen(): " + rQlen() + ", clength[0]: " + clength[0] + ", clength[1]: " + clength[1]);
rQshiftBytes(1 + clength[0]); // shift off ctl + compact length rQshiftBytes(1 + clength[0]); // shift off ctl + compact length
img = new Image(); img = new Image();
img.onload = scan_tight_imgs; img.onload = scan_tight_imgQ;
FBU.imgs.push([img, FBU.x, FBU.y]); FBU.imgQ.push([img, FBU.x, FBU.y]);
img.src = "data:image/" + cmode + img.src = "data:image/" + cmode +
extract_data_uri(rQshiftBytes(clength[1])); extract_data_uri(rQshiftBytes(clength[1]));
img = null; img = null;
...@@ -1346,16 +1346,16 @@ extract_data_uri = function(arr) { ...@@ -1346,16 +1346,16 @@ extract_data_uri = function(arr) {
return ";base64," + Base64.encode(arr); return ";base64," + Base64.encode(arr);
}; };
scan_tight_imgs = function() { scan_tight_imgQ = function() {
var img, imgs, ctx; var img, imgQ, ctx;
ctx = canvas.getContext(); ctx = canvas.getContext();
if (rfb_state === 'normal') { if (rfb_state === 'normal') {
imgs = FBU.imgs; imgQ = FBU.imgQ;
while ((imgs.length > 0) && (imgs[0][0].complete)) { while ((imgQ.length > 0) && (imgQ[0][0].complete)) {
img = imgs.shift(); img = imgQ.shift();
ctx.drawImage(img[0], img[1], img[2]); ctx.drawImage(img[0], img[1], img[2]);
} }
setTimeout(scan_tight_imgs, scan_imgs_rate); setTimeout(scan_tight_imgQ, scan_imgQ_rate);
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment