()
| 2861 | } |
| 2862 | |
| 2863 | _handleVMwareCursor() { |
| 2864 | const hotx = this._FBU.x; // hotspot-x |
| 2865 | const hoty = this._FBU.y; // hotspot-y |
| 2866 | const w = this._FBU.width; |
| 2867 | const h = this._FBU.height; |
| 2868 | if (this._sock.rQwait("VMware cursor encoding", 1)) { |
| 2869 | return false; |
| 2870 | } |
| 2871 | |
| 2872 | const cursorType = this._sock.rQshift8(); |
| 2873 | |
| 2874 | this._sock.rQshift8(); //Padding |
| 2875 | |
| 2876 | let rgba; |
| 2877 | const bytesPerPixel = 4; |
| 2878 | |
| 2879 | //Classic cursor |
| 2880 | if (cursorType == 0) { |
| 2881 | //Used to filter away unimportant bits. |
| 2882 | //OR is used for correct conversion in js. |
| 2883 | const PIXEL_MASK = 0xffffff00 | 0; |
| 2884 | rgba = new Array(w * h * bytesPerPixel); |
| 2885 | |
| 2886 | if (this._sock.rQwait("VMware cursor classic encoding", |
| 2887 | (w * h * bytesPerPixel) * 2, 2)) { |
| 2888 | return false; |
| 2889 | } |
| 2890 | |
| 2891 | let andMask = new Array(w * h); |
| 2892 | for (let pixel = 0; pixel < (w * h); pixel++) { |
| 2893 | andMask[pixel] = this._sock.rQshift32(); |
| 2894 | } |
| 2895 | |
| 2896 | let xorMask = new Array(w * h); |
| 2897 | for (let pixel = 0; pixel < (w * h); pixel++) { |
| 2898 | xorMask[pixel] = this._sock.rQshift32(); |
| 2899 | } |
| 2900 | |
| 2901 | for (let pixel = 0; pixel < (w * h); pixel++) { |
| 2902 | if (andMask[pixel] == 0) { |
| 2903 | //Fully opaque pixel |
| 2904 | let bgr = xorMask[pixel]; |
| 2905 | let r = bgr >> 8 & 0xff; |
| 2906 | let g = bgr >> 16 & 0xff; |
| 2907 | let b = bgr >> 24 & 0xff; |
| 2908 | |
| 2909 | rgba[(pixel * bytesPerPixel) ] = r; //r |
| 2910 | rgba[(pixel * bytesPerPixel) + 1 ] = g; //g |
| 2911 | rgba[(pixel * bytesPerPixel) + 2 ] = b; //b |
| 2912 | rgba[(pixel * bytesPerPixel) + 3 ] = 0xff; //a |
| 2913 | |
| 2914 | } else if ((andMask[pixel] & PIXEL_MASK) == |
| 2915 | PIXEL_MASK) { |
| 2916 | //Only screen value matters, no mouse colouring |
| 2917 | if (xorMask[pixel] == 0) { |
| 2918 | //Transparent pixel |
| 2919 | rgba[(pixel * bytesPerPixel) ] = 0x00; |
| 2920 | rgba[(pixel * bytesPerPixel) + 1 ] = 0x00; |
no test coverage detected