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

Function pixelFormat

systemvm/agent/noVNC/core/rfb.js:3492–3529  ·  view source on GitHub ↗
(sock, depth, trueColor)

Source from the content-addressed store, hash-verified

3490 },
3491
3492 pixelFormat(sock, depth, trueColor) {
3493 let bpp;
3494
3495 if (depth > 16) {
3496 bpp = 32;
3497 } else if (depth > 8) {
3498 bpp = 16;
3499 } else {
3500 bpp = 8;
3501 }
3502
3503 const bits = Math.floor(depth/3);
3504
3505 sock.sQpush8(0); // msg-type
3506
3507 sock.sQpush8(0); // padding
3508 sock.sQpush8(0); // padding
3509 sock.sQpush8(0); // padding
3510
3511 sock.sQpush8(bpp);
3512 sock.sQpush8(depth);
3513 sock.sQpush8(0); // little-endian
3514 sock.sQpush8(trueColor ? 1 : 0);
3515
3516 sock.sQpush16((1 << bits) - 1); // red-max
3517 sock.sQpush16((1 << bits) - 1); // green-max
3518 sock.sQpush16((1 << bits) - 1); // blue-max
3519
3520 sock.sQpush8(bits * 0); // red-shift
3521 sock.sQpush8(bits * 1); // green-shift
3522 sock.sQpush8(bits * 2); // blue-shift
3523
3524 sock.sQpush8(0); // padding
3525 sock.sQpush8(0); // padding
3526 sock.sQpush8(0); // padding
3527
3528 sock.flush();
3529 },
3530
3531 clientEncodings(sock, encodings) {
3532 sock.sQpush8(2); // msg-type

Callers

nothing calls this directly

Calls 3

sQpush8Method · 0.80
sQpush16Method · 0.80
flushMethod · 0.45

Tested by

no test coverage detected