copyrect.js 616 B

123456789101112131415161718192021222324252627
  1. /*
  2. * noVNC: HTML5 VNC client
  3. * Copyright (C) 2019 The noVNC Authors
  4. * Licensed under MPL 2.0 (see LICENSE.txt)
  5. *
  6. * See README.md for usage and integration instructions.
  7. *
  8. */
  9. export default class CopyRectDecoder {
  10. decodeRect(x, y, width, height, sock, display, depth) {
  11. if (sock.rQwait("COPYRECT", 4)) {
  12. return false;
  13. }
  14. let deltaX = sock.rQshift16();
  15. let deltaY = sock.rQshift16();
  16. if ((width === 0) || (height === 0)) {
  17. return true;
  18. }
  19. display.copyImage(deltaX, deltaY, x, y, width, height);
  20. return true;
  21. }
  22. }