()
| 2774 | } |
| 2775 | |
| 2776 | _framebufferUpdate() { |
| 2777 | if (this._FBU.rects === 0) { |
| 2778 | if (this._sock.rQwait("FBU header", 3, 1)) { return false; } |
| 2779 | this._sock.rQskipBytes(1); // Padding |
| 2780 | this._FBU.rects = this._sock.rQshift16(); |
| 2781 | |
| 2782 | // Make sure the previous frame is fully rendered first |
| 2783 | // to avoid building up an excessive queue |
| 2784 | if (this._display.pending()) { |
| 2785 | this._flushing = true; |
| 2786 | this._display.flush() |
| 2787 | .then(() => { |
| 2788 | this._flushing = false; |
| 2789 | // Resume processing |
| 2790 | if (!this._sock.rQwait("message", 1)) { |
| 2791 | this._handleMessage(); |
| 2792 | } |
| 2793 | }); |
| 2794 | return false; |
| 2795 | } |
| 2796 | } |
| 2797 | |
| 2798 | while (this._FBU.rects > 0) { |
| 2799 | if (this._FBU.encoding === null) { |
| 2800 | if (this._sock.rQwait("rect header", 12)) { return false; } |
| 2801 | /* New FramebufferUpdate */ |
| 2802 | |
| 2803 | this._FBU.x = this._sock.rQshift16(); |
| 2804 | this._FBU.y = this._sock.rQshift16(); |
| 2805 | this._FBU.width = this._sock.rQshift16(); |
| 2806 | this._FBU.height = this._sock.rQshift16(); |
| 2807 | this._FBU.encoding = this._sock.rQshift32(); |
| 2808 | /* Encodings are signed */ |
| 2809 | this._FBU.encoding >>= 0; |
| 2810 | } |
| 2811 | |
| 2812 | if (!this._handleRect()) { |
| 2813 | return false; |
| 2814 | } |
| 2815 | |
| 2816 | this._FBU.rects--; |
| 2817 | this._FBU.encoding = null; |
| 2818 | } |
| 2819 | |
| 2820 | this._display.flip(); |
| 2821 | |
| 2822 | return true; // We finished this FBU |
| 2823 | } |
| 2824 | |
| 2825 | _handleRect() { |
| 2826 | switch (this._FBU.encoding) { |
no test coverage detected