()
| 2615 | } |
| 2616 | |
| 2617 | _framebufferUpdate() { |
| 2618 | if (this._FBU.rects === 0) { |
| 2619 | if (this._sock.rQwait("FBU header", 3, 1)) { return false; } |
| 2620 | this._sock.rQskipBytes(1); // Padding |
| 2621 | this._FBU.rects = this._sock.rQshift16(); |
| 2622 | |
| 2623 | // Make sure the previous frame is fully rendered first |
| 2624 | // to avoid building up an excessive queue |
| 2625 | if (this._display.pending()) { |
| 2626 | this._flushing = true; |
| 2627 | this._display.flush() |
| 2628 | .then(() => { |
| 2629 | this._flushing = false; |
| 2630 | // Resume processing |
| 2631 | if (!this._sock.rQwait("message", 1)) { |
| 2632 | this._handleMessage(); |
| 2633 | } |
| 2634 | }); |
| 2635 | return false; |
| 2636 | } |
| 2637 | } |
| 2638 | |
| 2639 | while (this._FBU.rects > 0) { |
| 2640 | if (this._FBU.encoding === null) { |
| 2641 | if (this._sock.rQwait("rect header", 12)) { return false; } |
| 2642 | /* New FramebufferUpdate */ |
| 2643 | |
| 2644 | this._FBU.x = this._sock.rQshift16(); |
| 2645 | this._FBU.y = this._sock.rQshift16(); |
| 2646 | this._FBU.width = this._sock.rQshift16(); |
| 2647 | this._FBU.height = this._sock.rQshift16(); |
| 2648 | this._FBU.encoding = this._sock.rQshift32(); |
| 2649 | /* Encodings are signed */ |
| 2650 | this._FBU.encoding >>= 0; |
| 2651 | } |
| 2652 | |
| 2653 | if (!this._handleRect()) { |
| 2654 | return false; |
| 2655 | } |
| 2656 | |
| 2657 | this._FBU.rects--; |
| 2658 | this._FBU.encoding = null; |
| 2659 | } |
| 2660 | |
| 2661 | this._display.flip(); |
| 2662 | |
| 2663 | return true; // We finished this FBU |
| 2664 | } |
| 2665 | |
| 2666 | _handleRect() { |
| 2667 | switch (this._FBU.encoding) { |
no test coverage detected