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