2020-05-28 19:24:48 -04:00
|
|
|
var CreateAmtRemoteDesktop=function(t,a){var y={};function b(t){return String.fromCharCode.apply(null,t)}function C(t){for(var a=new Uint8Array(t.length),e=0,n=t.length;e<n;++e)a[e]=t.charCodeAt(e);return a}function D(t,a,e,n,o,r,i){var s,c,h,f,d=t[a++],v={},u=0,l=0;if(0==d){if(2==y.bpp)for(f=0;f<i;f++)L(t[a++]+(t[a++]<<8),f);else for(f=0;f<i;f++)K(t[a++],f);k(y.spare,e,n)}else if(1==d){c=t[a++]+(2==y.bpp?t[a++]<<8:0),y.canvas.fillStyle="rgb("+(1==y.bpp?(224&c)+","+((28&c)<<3)+","+A((3&c)<<6):(c>>8&248)+","+(c>>3&252)+","+((31&c)<<3))+")";var g=T(e,n);n=x(e,n),e=g,y.canvas.fillRect(e,n,o,r)}else if(1<d&&d<17){var p=4,m=15;if(2==y.bpp){for(f=0;f<d;f++)v[f]=t[a++]+(t[a++]<<8);for(2==d?m=p=1:d<=4&&(p=2,m=3);u<i&&a<t.byteLength;)for(c=t[a++],f=8-p;0<=f;f-=p)L(v[c>>f&m],u++)}else{for(f=0;f<d;f++)v[f]=t[a++];for(2==d?m=p=1:d<=4&&(p=2,m=3);u<i&&a<t.byteLength;)for(c=t[a++],f=8-p;0<=f;f-=p)K(v[c>>f&m],u++)}k(y.spare,e,n)}else if(128==d){if(2==y.bpp)for(;u<i&&a<t.byteLength;){for(c=t[a++]+(t[a++]<<8),l=1;l+=h=t[a++],255==h;);if(0==y.rotation)w(c,u,l),u+=l;else for(;0<=--l;)L(c,u++)}else for(;u<i&&a<t.byteLength;){for(c=t[a++],l=1;l+=h=t[a++],255==h;);if(0==y.rotation)S(c,u,l),u+=l;else for(;0<=--l;)K(c,u++)}k(y.spare,e,n)}else if(129<d){if(2==y.bpp)for(f=0;f<d-128;f++)v[f]=t[a++]+(t[a++]<<8);else for(f=0;f<d-128;f++)v[f]=t[a++];for(;u<i&&a<t.byteLength;){if(l=1,c=v[(s=t[a++])%128],127<s)for(;l+=h=t[a++],255==h;);if(0==y.rotation)2==y.bpp?w(c,u,l):S(c,u,l),u+=l;else if(2==y.bpp)for(;0<=--l;)L(c,u++);else for(;0<=--l;)K(c,u++)}k(y.spare,e,n)}}function k(t,a,e){if(1!=y.holding){var n=function(t,a){return 0==y.rotation?t:1==y.rotation?y.canvas.canvas.width-y.sparew2-a:2==y.rotation?y.canvas.canvas.width-y.sparew2-t:3==y.rotation?a:0}(a,e);e=function(t,a){return 0==y.rotation?a:1==y.rotation?t:2==y.rotation?y.canvas.canvas.height-y.spareh2-a:3==y.rotation?y.canvas.canvas.height-y.spareh-t:0}(a,e),a=n,y.canvas.putImageData(t,a,e)}}function K(t,a){var e=a<<2;if(0<y.rotation)if(1==y.rotation){var n=a%y.sparew,o=Math.floor(a/y.sparew);e=(a=n*y.sparew2+(y.sparew2-1-o))<<2}else if(2==y.rotation)e=y.sparew*y.spareh*4-4-e;else if(3==y.rotation){n=a%y.sparew,o=Math.floor(a/y.sparew);e=(a=(y.sparew2-1-n)*y.sparew2+o)<<2}y.spare.data[e]=224&t,y.spare.data[e+1]=(28&t)<<3,y.spare.data[e+2]=A((3&t)<<6)}function L(t,a){var e=a<<2;if(0<y.rotation)if(1==y.rotation){var n=a%y.sparew,o=Math.floor(a/y.sparew);e=(a=n*y.sparew2+(y.sparew2-1-o))<<2}else if(2==y.rotation)e=y.sparew*y.spareh*4-4-e;else if(3==y.rotation){n=a%y.sparew,o=Math.floor(a/y.sparew);e=(a=(y.sparew2-1-n)*y.sparew2+o)<<2}y.spare.data[e]=t>>8&248,y.spare.data[e+1]=t>>3&252,y.spare.data[e+2]=(31&t)<<3}function S(t,a,e){for(var n=a<<2,o=224&t,r=(28&t)<<3,i=A((3&t)<<6);0<=--e;)y.spare.data[n]=o,y.spare.data[n+1]=r,y.spare.data[n+2]=i,n+=4}function w(t,a,e){for(var n=a<<2,o=t>>8&248,r=t>>3&252,i=(31&t)<<3;0<=--e;)y.spare.data[n]=o,y.spare.data[n+1]=r,y.spare.data[n+2]=i,n+=4}function T(t){return 0==y.rotation?t:1==y.rotation?t:2==y.rotation?t-y.canvas.canvas.width:3==y.rotation?t-y.canvas.canvas.height:0}function x(t,a){return 0==y.rotation?a:1==y.rotation?a-y.canvas.canvas.width:2==y.rotation?a-y.canvas.canvas.height:3==y.rotation?a:0}function A(t){return 127<t?t+32:t}function I(){if(1!=y.holding)if(0<y.focusmode){var t=2*y.focusmode;y.send(String.fromCharCode(3,1)+ShortToStr(Math.max(Math.min(y.ox,y.mx)-y.focusmode,0))+ShortToStr(Math.max(Math.min(y.oy,y.my)-y.focusmode,0))+ShortToStr(t+Math.abs(y.ox-y.mx))+ShortToStr(t+Math.abs(y.oy-y.my))),y.ox=y.mx,y.oy=y.my}else y.send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(y.rwidth)+ShortToStr(y.rheight))}y.canvasid=t,y.CanvasId=Q(t),y.scrolldiv=a,y.canvas=Q(t).getContext("2d"),y.protocol=2,y.state=0,y.acc=null,y.ScreenWidth=960,y.ScreenHeight=700,y.width=0,y.height=0,y.rwidth=0,y.rheight=0,y.bpp=2,y.useZRLE=!0,y.showmouse=!0,y.buttonmask=0,y.localKeyMap=!0,y.spare=null,y.sparew=0,y.spareh=0,y.sparew2=0,y.spareh2=0,y.sparecache={},y.ZRLEfirst=1,y.onScreenSizeChange=null,y.frameRateDelay=0,y.noMouseRotate=!1,y.rotation=0,y.kvmDataSupported=!1,y.o
|