MCPcopy Create free account
hub / github.com/apache/cloudstack / _scanRenderQ

Method _scanRenderQ

systemvm/agent/noVNC/core/display.js:498–574  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

496 }
497
498 _scanRenderQ() {
499 let ready = true;
500 while (ready && this._renderQ.length > 0) {
501 const a = this._renderQ[0];
502 switch (a.type) {
503 case 'flip':
504 this.flip(true);
505 break;
506 case 'copy':
507 this.copyImage(a.oldX, a.oldY, a.x, a.y, a.width, a.height, true);
508 break;
509 case 'fill':
510 this.fillRect(a.x, a.y, a.width, a.height, a.color, true);
511 break;
512 case 'blit':
513 this.blitImage(a.x, a.y, a.width, a.height, a.data, 0, true);
514 break;
515 case 'img':
516 if (a.img.complete) {
517 if (a.img.width !== a.width || a.img.height !== a.height) {
518 Log.Error("Decoded image has incorrect dimensions. Got " +
519 a.img.width + "x" + a.img.height + ". Expected " +
520 a.width + "x" + a.height + ".");
521 return;
522 }
523 this.drawImage(a.img, a.x, a.y);
524 } else {
525 a.img._noVNCDisplay = this;
526 a.img.addEventListener('load', this._resumeRenderQ);
527 // We need to wait for this image to 'load'
528 // to keep things in-order
529 ready = false;
530 }
531 break;
532 case 'frame':
533 if (a.frame.ready) {
534 // The encoded frame may be larger than the rect due to
535 // limitations of the encoder, so we need to crop the
536 // frame.
537 let frame = a.frame.frame;
538 if (frame.codedWidth < a.width || frame.codedHeight < a.height) {
539 Log.Warn("Decoded video frame does not cover its full rectangle area. Expecting at least " +
540 a.width + "x" + a.height + " but got " +
541 frame.codedWidth + "x" + frame.codedHeight);
542 }
543 const sx = 0;
544 const sy = 0;
545 const sw = a.width;
546 const sh = a.height;
547 const dx = a.x;
548 const dy = a.y;
549 const dw = sw;
550 const dh = sh;
551 this.drawImage(frame, sx, sy, sw, sh, dx, dy, dw, dh);
552 frame.close();
553 } else {
554 let display = this;
555 a.frame.promise.then(() => {

Callers 2

_renderQPushMethod · 0.95
_resumeRenderQMethod · 0.80

Calls 7

flipMethod · 0.95
copyImageMethod · 0.95
fillRectMethod · 0.95
blitImageMethod · 0.95
drawImageMethod · 0.95
addEventListenerMethod · 0.80
closeMethod · 0.65

Tested by

no test coverage detected