| 26 | } |
| 27 | |
| 28 | decodeRect(x, y, width, height, sock, display, depth) { |
| 29 | if (this._ctl === null) { |
| 30 | if (sock.rQwait("TIGHT compression-control", 1)) { |
| 31 | return false; |
| 32 | } |
| 33 | |
| 34 | this._ctl = sock.rQshift8(); |
| 35 | |
| 36 | // Reset streams if the server requests it |
| 37 | for (let i = 0; i < 4; i++) { |
| 38 | if ((this._ctl >> i) & 1) { |
| 39 | this._zlibs[i].reset(); |
| 40 | Log.Info("Reset zlib stream " + i); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | // Figure out filter |
| 45 | this._ctl = this._ctl >> 4; |
| 46 | } |
| 47 | |
| 48 | let ret; |
| 49 | |
| 50 | if (this._ctl === 0x08) { |
| 51 | ret = this._fillRect(x, y, width, height, |
| 52 | sock, display, depth); |
| 53 | } else if (this._ctl === 0x09) { |
| 54 | ret = this._jpegRect(x, y, width, height, |
| 55 | sock, display, depth); |
| 56 | } else if (this._ctl === 0x0A) { |
| 57 | ret = this._pngRect(x, y, width, height, |
| 58 | sock, display, depth); |
| 59 | } else if ((this._ctl & 0x08) == 0) { |
| 60 | ret = this._basicRect(this._ctl, x, y, width, height, |
| 61 | sock, display, depth); |
| 62 | } else { |
| 63 | throw new Error("Illegal tight compression received (ctl: " + |
| 64 | this._ctl + ")"); |
| 65 | } |
| 66 | |
| 67 | if (ret) { |
| 68 | this._ctl = null; |
| 69 | } |
| 70 | |
| 71 | return ret; |
| 72 | } |
| 73 | |
| 74 | _fillRect(x, y, width, height, sock, display, depth) { |
| 75 | if (sock.rQwait("TIGHT", 3)) { |