MCPcopy Create free account
hub / github.com/TigerVNC/tigervnc / FilterPalette32

Method FilterPalette32

java/com/tigervnc/rfb/TightDecoder.java:582–620  ·  view source on GitHub ↗
(IntBuffer palette, int palSize,
                               ByteBuffer inbuf, IntBuffer outbuf,
                               int stride, Rect r)

Source from the content-addressed store, hash-verified

580 }
581
582 private void FilterPalette32(IntBuffer palette, int palSize,
583 ByteBuffer inbuf, IntBuffer outbuf,
584 int stride, Rect r)
585 {
586 // Indexed color
587 int x, h = r.height(), w = r.width(), b, pad = stride - w;
588 IntBuffer ptr = outbuf.duplicate();
589 byte bits;
590 ByteBuffer srcPtr = inbuf.duplicate();
591 if (palSize <= 2) {
592 // 2-color palette
593 while (h > 0) {
594 for (x = 0; x < w / 8; x++) {
595 bits = srcPtr.get();
596 for (b = 7; b >= 0; b--) {
597 ptr.put(palette.get(bits >> b & 1));
598 }
599 }
600 if (w % 8 != 0) {
601 bits = srcPtr.get();
602 for (b = 7; b >= 8 - w % 8; b--) {
603 ptr.put(palette.get(bits >> b & 1));
604 }
605 }
606 ptr.position(ptr.position() + pad);
607 h--;
608 }
609 } else {
610 // 256-color palette
611 while (h > 0) {
612 int endOfRow = ptr.position() + w;
613 while (ptr.position() < endOfRow) {
614 ptr.put(palette.get(srcPtr.get() & 0xff));
615 }
616 ptr.position(ptr.position() + pad);
617 h--;
618 }
619 }
620 }
621
622 public final int readCompact(InStream is) {
623 byte b;

Callers 1

decodeRectMethod · 0.95

Calls 5

positionMethod · 0.80
heightMethod · 0.45
widthMethod · 0.45
getMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected