(Rect r, InStream is,
ServerParams server, OutStream os)
| 59 | } |
| 60 | |
| 61 | public void readRect(Rect r, InStream is, |
| 62 | ServerParams server, OutStream os) |
| 63 | { |
| 64 | int comp_ctl; |
| 65 | |
| 66 | comp_ctl = is.readU8(); |
| 67 | os.writeU8(comp_ctl); |
| 68 | |
| 69 | comp_ctl >>= 4; |
| 70 | |
| 71 | // "Fill" compression type. |
| 72 | if (comp_ctl == tightFill) { |
| 73 | if (server.pf().is888()) |
| 74 | os.copyBytes(is, 3); |
| 75 | else |
| 76 | os.copyBytes(is, server.pf().bpp/8); |
| 77 | return; |
| 78 | } |
| 79 | |
| 80 | // "JPEG" compression type. |
| 81 | if (comp_ctl == tightJpeg) { |
| 82 | int len; |
| 83 | |
| 84 | len = readCompact(is); |
| 85 | os.writeOpaque32(len); |
| 86 | os.copyBytes(is, len); |
| 87 | return; |
| 88 | } |
| 89 | |
| 90 | // Quit on unsupported compression type. |
| 91 | if (comp_ctl > tightMaxSubencoding) |
| 92 | throw new Exception("TightDecoder: bad subencoding value received"); |
| 93 | |
| 94 | // "Basic" compression type. |
| 95 | |
| 96 | int palSize = 0; |
| 97 | |
| 98 | if (r.width() > TIGHT_MAX_WIDTH) |
| 99 | throw new Exception("TightDecoder: too large rectangle ("+r.width()+" pixels)"); |
| 100 | |
| 101 | // Possible palette |
| 102 | if ((comp_ctl & tightExplicitFilter) != 0) { |
| 103 | int filterId; |
| 104 | |
| 105 | filterId = is.readU8() & 0xff; |
| 106 | os.writeU8(filterId); |
| 107 | |
| 108 | switch (filterId) { |
| 109 | case tightFilterPalette: |
| 110 | palSize = is.readU8() + 1; |
| 111 | os.writeU32(palSize - 1); |
| 112 | |
| 113 | if (server.pf().is888()) |
| 114 | os.copyBytes(is, palSize * 3); |
| 115 | else |
| 116 | os.copyBytes(is, palSize * server.pf().bpp/8); |
| 117 | break; |
| 118 | case tightFilterGradient: |
nothing calls this directly
no test coverage detected