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

Method bufferFromPixel

java/com/tigervnc/rfb/PixelFormat.java:533–558  ·  view source on GitHub ↗
(ByteBuffer buffer, int p)

Source from the content-addressed store, hash-verified

531 }
532
533 public void bufferFromPixel(ByteBuffer buffer, int p)
534 {
535 if (bigEndian) {
536 switch (bpp) {
537 case 32:
538 buffer.put((byte)((p >> 24) & 0xff));
539 buffer.put((byte)((p >> 16) & 0xff));
540 break;
541 case 16:
542 buffer.put((byte)((p >> 8) & 0xff));
543 break;
544 case 8:
545 buffer.put((byte)((p >> 0) & 0xff));
546 break;
547 }
548 } else {
549 buffer.put(0, (byte)((p >> 0) & 0xff));
550 if (bpp >= 16) {
551 buffer.put(1, (byte)((p >> 8) & 0xff));
552 if (bpp == 32) {
553 buffer.put(2, (byte)((p >> 16) & 0xff));
554 buffer.put(3, (byte)((p >> 24) & 0xff));
555 }
556 }
557 }
558 }
559
560 public ColorModel getColorModel()
561 {

Callers 4

bufferFromRGBMethod · 0.95
makePixelFunction · 0.80
TEST_PFunction · 0.80
writePixelsMethod · 0.80

Calls 1

putMethod · 0.45

Tested by

no test coverage detected