2020-11-24 03:54:28 +03:00
|
|
|
var CreateAmtRemoteDesktop=function(a,t){var y={};function b(a){return String.fromCharCode.apply(null,a)}function C(a){for(var t=new Uint8Array(a.length),e=0,n=a.length;e<n;++e)t[e]=a.charCodeAt(e);return t}function D(a,t,e,n,o,r,i){var s,c,h,f,v=a[t++],d={},u=0,l=0;if(0==v){if(2==y.bpp)for(f=0;f<i;f++)L(a[t++]+(a[t++]<<8),f);else for(f=0;f<i;f++)K(a[t++],f);k(y.spare,e,n)}else if(1==v){c=a[t++]+(2==y.bpp?a[t++]<<8:0),y.canvas.fillStyle="rgb("+(1==y.bpp?(224&c)+","+((28&c)<<3)+","+M((3&c)<<6):(c>>8&248)+","+(c>>3&252)+","+((31&c)<<3))+")";var p=T(e,n);n=x(e,n),e=p,y.canvas.fillRect(e,n,o,r)}else if(1<v&&v<17){var g=4,m=15;if(2==y.bpp){for(f=0;f<v;f++)d[f]=a[t++]+(a[t++]<<8);for(2==v?m=g=1:v<=4&&(g=2,m=3);u<i&&t<a.byteLength;)for(c=a[t++],f=8-g;0<=f;f-=g)L(d[c>>f&m],u++)}else{for(f=0;f<v;f++)d[f]=a[t++];for(2==v?m=g=1:v<=4&&(g=2,m=3);u<i&&t<a.byteLength;)for(c=a[t++],f=8-g;0<=f;f-=g)K(d[c>>f&m],u++)}k(y.spare,e,n)}else if(128==v){if(2==y.bpp)for(;u<i&&t<a.byteLength;){for(c=a[t++]+(a[t++]<<8),l=1;l+=h=a[t++],255==h;);if(0==y.rotation)w(c,u,l),u+=l;else for(;0<=--l;)L(c,u++)}else for(;u<i&&t<a.byteLength;){for(c=a[t++],l=1;l+=h=a[t++],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<v){if(2==y.bpp)for(f=0;f<v-128;f++)d[f]=a[t++]+(a[t++]<<8);else for(f=0;f<v-128;f++)d[f]=a[t++];for(;u<i&&t<a.byteLength;){if(l=1,c=d[(s=a[t++])%128],127<s)for(;l+=h=a[t++],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(a,t,e){if(1!=y.holding){var n=function(a,t){return 0==y.rotation?a:1==y.rotation?y.canvas.canvas.width-y.sparew2-t:2==y.rotation?y.canvas.canvas.width-y.sparew2-a:3==y.rotation?t:0}(t,e);e=function(a,t){return 0==y.rotation?t:1==y.rotation?a:2==y.rotation?y.canvas.canvas.height-y.spareh2-t:3==y.rotation?y.canvas.canvas.height-y.spareh-a:0}(t,e),t=n,y.canvas.putImageData(a,t,e)}}function K(a,t){var e=t<<2;if(0<y.rotation)if(1==y.rotation){var n=t%y.sparew,o=Math.floor(t/y.sparew);e=(t=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=t%y.sparew,o=Math.floor(t/y.sparew);e=(t=(y.sparew2-1-n)*y.sparew2+o)<<2}y.spare.data[e]=224&a,y.spare.data[e+1]=(28&a)<<3,y.spare.data[e+2]=M((3&a)<<6)}function L(a,t){var e=t<<2;if(0<y.rotation)if(1==y.rotation){var n=t%y.sparew,o=Math.floor(t/y.sparew);e=(t=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=t%y.sparew,o=Math.floor(t/y.sparew);e=(t=(y.sparew2-1-n)*y.sparew2+o)<<2}y.spare.data[e]=a>>8&248,y.spare.data[e+1]=a>>3&252,y.spare.data[e+2]=(31&a)<<3}function S(a,t,e){for(var n=t<<2,o=224&a,r=(28&a)<<3,i=M((3&a)<<6);0<=--e;)y.spare.data[n]=o,y.spare.data[n+1]=r,y.spare.data[n+2]=i,n+=4}function w(a,t,e){for(var n=t<<2,o=a>>8&248,r=a>>3&252,i=(31&a)<<3;0<=--e;)y.spare.data[n]=o,y.spare.data[n+1]=r,y.spare.data[n+2]=i,n+=4}function T(a){return 0==y.rotation?a:1==y.rotation?a:2==y.rotation?a-y.canvas.canvas.width:3==y.rotation?a-y.canvas.canvas.height:0}function x(a,t){return 0==y.rotation?t:1==y.rotation?t-y.canvas.canvas.width:2==y.rotation?t-y.canvas.canvas.height:3==y.rotation?t:0}function M(a){return 127<a?a+32:a}function A(){if(1!=y.holding)if(0<y.focusmode){var a=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(a+Math.abs(y.ox-y.mx))+ShortToStr(a+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=a,y.CanvasId=Q(a),y.scrolldiv=t,y.canvas=Q(a).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
|