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

Method decodeRect

java/com/tigervnc/rfb/ZRLEDecoder.java:65–100  ·  view source on GitHub ↗
(Rect r, Object buffer,
                         int buflen, ServerParams server,
                         ModifiablePixelBuffer pb)

Source from the content-addressed store, hash-verified

63 }
64
65 public void decodeRect(Rect r, Object buffer,
66 int buflen, ServerParams server,
67 ModifiablePixelBuffer pb)
68 {
69 MemInStream is = new MemInStream((byte[])buffer, 0, buflen);
70 PixelFormat pf = server.pf();
71 switch (pf.bpp) {
72 case 8: zrleDecode8(r, is, zis, pf, pb); break;
73 case 16: zrleDecode16(r, is, zis, pf, pb); break;
74 case 32:
75 {
76 if (pf.depth <= 24) {
77 int maxPixel = pf.pixelFromRGB(-1, -1, -1, pf.getColorModel());
78 boolean fitsInLS3Bytes = maxPixel < (1<<24);
79 boolean fitsInMS3Bytes = (maxPixel & 0xff) == 0;
80
81 if ((fitsInLS3Bytes && pf.isLittleEndian()) ||
82 (fitsInMS3Bytes && pf.isBigEndian()))
83 {
84 zrleDecode24A(r, is, zis, pf, pb);
85 break;
86 }
87
88 if ((fitsInLS3Bytes && pf.isBigEndian()) ||
89 (fitsInMS3Bytes && pf.isLittleEndian()))
90 {
91 zrleDecode24B(r, is, zis, pf, pb);
92 break;
93 }
94 }
95
96 zrleDecode32(r, is, zis, pf, pb);
97 break;
98 }
99 }
100 }
101
102 private static enum PIXEL_T { U8, U16, U24A, U24B, U32 };
103

Callers

nothing calls this directly

Calls 10

zrleDecode8Method · 0.95
zrleDecode16Method · 0.95
pixelFromRGBMethod · 0.95
getColorModelMethod · 0.95
isLittleEndianMethod · 0.95
isBigEndianMethod · 0.95
zrleDecode24AMethod · 0.95
zrleDecode24BMethod · 0.95
zrleDecode32Method · 0.95
pfMethod · 0.80

Tested by

no test coverage detected