annotate src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java @ 589:ef5033b06019

fix compress length in flush
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 12 Feb 2020 21:54:40 +0900
parents f01eef88010f
children 3accb09e430c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1 // Copyright (C) 2010, 2011, 2012, 2013 GlavSoft LLC.
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 // All rights reserved.
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 //-------------------------------------------------------------------------
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 // This file is part of the TightVNC software. Please visit our Web site:
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 // http://www.tightvnc.com/
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 // This program is free software; you can redistribute it and/or modify
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 // it under the terms of the GNU General Public License as published by
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 // the Free Software Foundation; either version 2 of the License, or
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 // (at your option) any later version.
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 // This program is distributed in the hope that it will be useful,
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 // GNU General Public License for more details.
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 // You should have received a copy of the GNU General Public License along
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 // with this program; if not, write to the Free Software Foundation, Inc.,
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 //-------------------------------------------------------------------------
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 package com.glavsoft.rfb.encoding.decoder;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 import com.glavsoft.drawing.Renderer;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 import com.glavsoft.exceptions.TransportException;
526
fcd833c2e148 Multicast Bloking in ZRLEDecoder
riono210
parents: 515
diff changeset
29 import com.glavsoft.rfb.encoding.EncodingType;
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
30 import com.glavsoft.rfb.protocol.ReceiverTask;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 import com.glavsoft.transport.Reader;
526
fcd833c2e148 Multicast Bloking in ZRLEDecoder
riono210
parents: 515
diff changeset
32 import jp.ac.u_ryukyu.treevnc.CheckDelay;
498
8d95d64c33bf add multicastPut
oshiro
parents: 275
diff changeset
33 import jp.ac.u_ryukyu.treevnc.TreeRFBProto;
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
34
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
35 import java.awt.*;
526
fcd833c2e148 Multicast Bloking in ZRLEDecoder
riono210
parents: 515
diff changeset
36 import java.io.UnsupportedEncodingException;
fcd833c2e148 Multicast Bloking in ZRLEDecoder
riono210
parents: 515
diff changeset
37 import java.nio.ByteBuffer;
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
38 import java.util.LinkedList;
526
fcd833c2e148 Multicast Bloking in ZRLEDecoder
riono210
parents: 515
diff changeset
39 import java.util.zip.Deflater;
fcd833c2e148 Multicast Bloking in ZRLEDecoder
riono210
parents: 515
diff changeset
40
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 public class ZRLEDecoder extends ZlibDecoder {
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
42 private static final int MAX_TILE_SIZE = 64;
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
43 private int[] decodedBitmap;
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
44 private int[] palette;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
46 class TileLoop {
535
17a2d0ea5c03 fix on ZRLEDecoder
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 534
diff changeset
47 private final boolean blocking;
578
c6893847c73a zlib flush margin 16kbytes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 577
diff changeset
48 final int MARGIN = 18000;
c6893847c73a zlib flush margin 16kbytes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 577
diff changeset
49 final int deflate_size = 60000-MARGIN;
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
50 private ByteBuffer c1;
532
9292035b8d93 fix forloop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 531
diff changeset
51 private int width; // phase2 length
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
52 private FramebufferUpdateRectangle c0rect,c1rect,rect;
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
53 private int prevLineOffset;
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
54 private int prevC1Offset;
541
355954eac478 fix ZRLEDecoder
riono
parents: 539
diff changeset
55 private int prevC1LineOffset;
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
56 private int prevoffset;
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
57 private Deflater deflater;
572
a0eeba3ee5d4 make bytes test routine
riono
parents: 571
diff changeset
58 private int flushOffset;
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
59
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
60 /**
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
61 * Multicast framebufferUpdate to children.
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
62 * read FrameBuffferUpdate. If it is ZLE, make it ZLEE which is self contained compressed packet.
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
63 * put the packet to the multicastqueue. Then normal rendering engine read the same stream using is.reset().
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
64 * <p>
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
65 * Haeder
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
66 * messageID ( FrameBuffer Update
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
67 * 1 byte padding
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
68 * 2 byte numberofrectangle
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
69 * 2 - U16 - x-position
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
70 * 2 - U16 - y-position
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
71 * 2 - U16 - width
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
72 * 2 - U16 - height
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
73 * 4 - S32 - encoding-type
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
74 * 4 byte datalengths
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
75 * datalengths databyte
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
76 *
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
77 * @throws TransportException
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
78 * @throws UnsupportedEncodingException
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
79 */
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
80
566
e93a8058344d several fixes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
81 public TileLoop(TreeRFBProto rfb, int offset) {
577
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
82 prevoffset = prevLineOffset = flushOffset = offset;
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
83 prevC1Offset = 0;
566
e93a8058344d several fixes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
84 if (rfb == null || offset < deflate_size + spanGap) {
535
17a2d0ea5c03 fix on ZRLEDecoder
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 534
diff changeset
85 // packet size fit in broadcast send it all at once
17a2d0ea5c03 fix on ZRLEDecoder
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 534
diff changeset
86 blocking = false;
17a2d0ea5c03 fix on ZRLEDecoder
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 534
diff changeset
87 } else
17a2d0ea5c03 fix on ZRLEDecoder
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 534
diff changeset
88 blocking = true;
533
4be31e107121 fix bloking
riono210
parents: 532
diff changeset
89 }
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
90
535
17a2d0ea5c03 fix on ZRLEDecoder
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 534
diff changeset
91 private void zrleeBlocking(TreeRFBProto rfb, ByteBuffer header, FramebufferUpdateRectangle rect, byte bytes[]) {
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
92 // dump32(inputs);
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
93 deflater = rfb.deflater;
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
94 this.rect = rect;
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
95 c0rect = null;
541
355954eac478 fix ZRLEDecoder
riono
parents: 539
diff changeset
96 c1rect = new FramebufferUpdateRectangle(rect.x, rect.y, 0, 0);
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
97 newMulticastPacket(rfb);
568
44920845d4e1 fix write data position
riono
parents: 566
diff changeset
98 //c1.put(header.get(0));
535
17a2d0ea5c03 fix on ZRLEDecoder
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 534
diff changeset
99 if (!blocking) {
579
5bc128c8e6aa fix offset
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 578
diff changeset
100 deflater.setInput(bytes, 0,(int) prevoffset);
535
17a2d0ea5c03 fix on ZRLEDecoder
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 534
diff changeset
101 deflater.deflate(c1);
572
a0eeba3ee5d4 make bytes test routine
riono
parents: 571
diff changeset
102 flushMuticast(rfb, bytes);
535
17a2d0ea5c03 fix on ZRLEDecoder
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 534
diff changeset
103 }
532
9292035b8d93 fix forloop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 531
diff changeset
104 return;
9292035b8d93 fix forloop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 531
diff changeset
105 }
9292035b8d93 fix forloop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 531
diff changeset
106
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
107 private void newMulticastPacket(TreeRFBProto rfb) {
578
c6893847c73a zlib flush margin 16kbytes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 577
diff changeset
108 c1 = rfb.multicastqueue.allocate(deflate_size + MARGIN);
c6893847c73a zlib flush margin 16kbytes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 577
diff changeset
109 c1.limit(deflate_size);
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
110 if (rfb.addSerialNum)
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
111 c1.putLong(rfb.counter++);
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
112 if (rfb.checkDelay)
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
113 CheckDelay.checkDelay(c1, rect.x, rect.y, rect.width, rect.height, System.currentTimeMillis(), EncodingType.CHECK_DELAY);
541
355954eac478 fix ZRLEDecoder
riono
parents: 539
diff changeset
114 c1.put((byte) 0);
532
9292035b8d93 fix forloop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 531
diff changeset
115 c1.put((byte) 0);
9292035b8d93 fix forloop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 531
diff changeset
116 c1.putShort((short) 0);
550
9c0cbe119155 fix make rectangle packet in client
e165729 <e165729@ie.u-ryukyu.ac.jp>
parents: 545
diff changeset
117 c1.position(c1.position() + 12);
532
9292035b8d93 fix forloop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 531
diff changeset
118 c1.putInt(0); // should be data length
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
119 prevC1Offset = c1.position();
541
355954eac478 fix ZRLEDecoder
riono
parents: 539
diff changeset
120 prevC1LineOffset = prevC1Offset;
355954eac478 fix ZRLEDecoder
riono
parents: 539
diff changeset
121 c1rect.width = c1rect.height = 0;
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
122 c0rect = null;
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
123 }
531
13d3c4341d14 remove .idea modules fix for loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 529
diff changeset
124
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
125 int spanGap = 128;
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
126 /**
534
a3d0ba67e8cf try 512 tiles / 256 tiles flush
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 533
diff changeset
127 * Series of tiles compose at most three rectangles. SYNC_FLUSH is necessary on
a3d0ba67e8cf try 512 tiles / 256 tiles flush
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 533
diff changeset
128 * rectangle boundaries.
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
129 *
545
1ba61b57be39 add test routine in -p ( running as root mode )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
130 * +----+
1ba61b57be39 add test routine in -p ( running as root mode )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
131 * | | phase 0
1ba61b57be39 add test routine in -p ( running as root mode )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
132 * +---------------+
1ba61b57be39 add test routine in -p ( running as root mode )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
133 * | | phase 1
1ba61b57be39 add test routine in -p ( running as root mode )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
134 * +----+----------+
1ba61b57be39 add test routine in -p ( running as root mode )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
135 * | | phase 2
1ba61b57be39 add test routine in -p ( running as root mode )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
136 * +----+
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
137 *
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
138 * Broadcast packet have to be less than 64kbytes
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
139 * A tile 64x64x4 166384byte
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
140 *
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
141 * we cannot rewind zlib stream, zlib stream have to be flushed at the end of rectangles
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
142 * if we leave 16kbytes space margin, zlib stream can be flushed safely
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
143 *
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
144 * keep completed previous rectangle in c0rect, which is possibly none.
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
145 * at the last or packet full, flush c0rect first, then flush c1rect if it exists
534
a3d0ba67e8cf try 512 tiles / 256 tiles flush
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 533
diff changeset
146 *
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
147 * @param rfb
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
148 * @param last
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
149 * @param bytes
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
150 * @param offset
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
151 * @param tileW
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
152 * @param tileH
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
153 */
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
154
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
155 public void multicastPut(TreeRFBProto rfb, boolean last, byte[] bytes, int offset, int tileW, int tileH) {
535
17a2d0ea5c03 fix on ZRLEDecoder
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 534
diff changeset
156 if (!blocking) return;
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
157 int span = offset - prevoffset;
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
158 deflater.setInput(bytes, prevoffset, span);
577
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
159 do {
580
c7527f24e344 fix deflatr
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 579
diff changeset
160 deflater.deflate(c1, Deflater. SYNC_FLUSH);
578
c6893847c73a zlib flush margin 16kbytes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 577
diff changeset
161 if (!deflater.needsInput()) {
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
162 // packet full
580
c7527f24e344 fix deflatr
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 579
diff changeset
163 flushDeflator();
c7527f24e344 fix deflatr
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 579
diff changeset
164 prevoffset = flushOffset+(int)deflater.getBytesRead();
581
aef7d24b430d add dump
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 580
diff changeset
165 assert(prevoffset==offset);
aef7d24b430d add dump
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 580
diff changeset
166 System.out.println("od prevOffset = "+prevoffset+" span = "+(prevoffset-flushOffset));
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
167 if (c0rect!=null) { flushRectangle(c0rect); moveNext(); } // finish pahse 1
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
168 flushRectangle(c1rect); // phase 2
577
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
169 flushMuticast(rfb, bytes);
581
aef7d24b430d add dump
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 580
diff changeset
170 if (last) {
577
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
171 return;
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
172 } else {
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
173 newMulticastPacket(rfb);
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
174 if (width<rect.width) { // phase 0
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
175 c1rect.x = rect.x + width;
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
176 } else {
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
177 c1rect.x = 0; // phase 1
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
178 c1rect.y += tileH;
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
179 }
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
180 return;
577
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
181 }
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
182 }
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
183 } while (! deflater.needsInput());
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
184 prevoffset = offset;
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
185 if (last) {
580
c7527f24e344 fix deflatr
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 579
diff changeset
186 flushDeflator();
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
187 if (c0rect!=null) { flushRectangle(c0rect); moveNext(); }
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
188 flushRectangle(c1rect);
572
a0eeba3ee5d4 make bytes test routine
riono
parents: 571
diff changeset
189 flushMuticast(rfb, bytes);
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
190 return;
564
0751cb6c0715 fix deflator
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 563
diff changeset
191 }
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
192 width += tileW;
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
193 if (c1rect.height==0) c1rect.height = tileH;
532
9292035b8d93 fix forloop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 531
diff changeset
194 if (c1rect.x > rect.x) { // phase 0
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
195 assert(c0rect==null);
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
196 if (c1rect.x + c1rect.width < rect.x + rect.width) {
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
197 c1rect.x += tileW;
564
0751cb6c0715 fix deflator
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 563
diff changeset
198 } else { // end of phase 0
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
199 flushRectangle(c1rect);
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
200 c1.position((c1.position()+16)); // make next header space
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
201 c1rect = new FramebufferUpdateRectangle(rect.x,c1rect.y+tileH,0,0);
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
202 }
538
6620e04f994c fix ZRLEDecoder
riono
parents: 535
diff changeset
203 } else { // phase 1
564
0751cb6c0715 fix deflator
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 563
diff changeset
204 if (width >= rect.width) { // next line
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
205 deflater.deflate(c1,Deflater.FULL_FLUSH);
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
206 prevC1LineOffset = c1.position();
532
9292035b8d93 fix forloop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 531
diff changeset
207 c1rect.width = rect.width;
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
208 if (c0rect!=null) { // extend phase 1
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
209 c0rect.height += tileH;
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
210 c1rect = new FramebufferUpdateRectangle(rect.x, c0rect.y+c0rect.height,0,0);
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
211 } else { // first phase 1 case
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
212 c1rect.height = tileH;
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
213 c0rect = c1rect;
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
214 c1rect = new FramebufferUpdateRectangle(rect.x, c1rect.y+c1rect.height,0,0);
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
215 }
532
9292035b8d93 fix forloop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 531
diff changeset
216 width = 0;
531
13d3c4341d14 remove .idea modules fix for loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 529
diff changeset
217 prevLineOffset = offset;
534
a3d0ba67e8cf try 512 tiles / 256 tiles flush
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 533
diff changeset
218 }
a3d0ba67e8cf try 512 tiles / 256 tiles flush
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 533
diff changeset
219 }
a3d0ba67e8cf try 512 tiles / 256 tiles flush
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 533
diff changeset
220 }
a3d0ba67e8cf try 512 tiles / 256 tiles flush
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 533
diff changeset
221
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
222 public void moveNext() {
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
223 // previous rectangle is finished, make next header space and copy already compressed part
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
224 c1.limit(c1.limit()+16);
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
225 System.arraycopy(c1.array(),prevC1LineOffset,16,prevC1LineOffset+16,c1.position()-prevC1LineOffset);
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
226 }
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
227
580
c7527f24e344 fix deflatr
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 579
diff changeset
228 private void flushDeflator() {
578
c6893847c73a zlib flush margin 16kbytes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 577
diff changeset
229 c1.limit(c1.limit() + MARGIN);
c6893847c73a zlib flush margin 16kbytes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 577
diff changeset
230 deflater.deflate(c1, Deflater.FULL_FLUSH);
c6893847c73a zlib flush margin 16kbytes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 577
diff changeset
231 if (c1.remaining()==0) {
c6893847c73a zlib flush margin 16kbytes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 577
diff changeset
232 System.out.println("Multicast packet overrun.");
c6893847c73a zlib flush margin 16kbytes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 577
diff changeset
233 }
c6893847c73a zlib flush margin 16kbytes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 577
diff changeset
234 }
c6893847c73a zlib flush margin 16kbytes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 577
diff changeset
235
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
236 private void bufdump(byte[] bytes,int beigin, int end) {
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
237 ReceiverTask.dump("in ",bytes,beigin,8); ReceiverTask.dump("... ",bytes,end,8);
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
238 System.out.println();
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
239 }
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
240
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
241 /**
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
242 * fix rectangle header
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
243 * create next rectangle header
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
244 * update position paramater
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
245 * send muticast pacate if nessesally
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
246 */
532
9292035b8d93 fix forloop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 531
diff changeset
247 private void flushRectangle(FramebufferUpdateRectangle rect) {
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
248 c1.putShort(prevC1Offset - 16, (short) rect.x);
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
249 c1.putShort(prevC1Offset - 14, (short) rect.y);
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
250 c1.putShort(prevC1Offset - 12, (short) rect.width);
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
251 c1.putShort(prevC1Offset - 10, (short) rect.height);
550
9c0cbe119155 fix make rectangle packet in client
e165729 <e165729@ie.u-ryukyu.ac.jp>
parents: 545
diff changeset
252 c1.putInt(prevC1Offset - 8, EncodingType.ZRLEE.getId());
589
ef5033b06019 fix compress length in flush
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 582
diff changeset
253 c1.putInt(prevC1Offset - 4, c1.position() - prevC1Offset ); // data length
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
254 c1.putShort(2, (short) (c1.getShort(2) + 1)); // increment rectangle count
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
255 prevC1Offset = c1.position();
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
256 }
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
257
581
aef7d24b430d add dump
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 580
diff changeset
258 private void flushMuticast(TreeRFBProto rfb, byte[] bytes) {
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
259 c1.flip();
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
260 //System.out.println("multicastPut: " + c1rect + " length: " + (c1.remaining()-c1headerPos-header.limit()));
563
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 560
diff changeset
261 deflater.reset();
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 560
diff changeset
262 LinkedList<ByteBuffer> bufs = new LinkedList<ByteBuffer>();
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 560
diff changeset
263 bufs.add(c1);
581
aef7d24b430d add dump
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 580
diff changeset
264 rfb.getContext().checkFrameBufferRectanble(c1, bytes, flushOffset, prevoffset);
572
a0eeba3ee5d4 make bytes test routine
riono
parents: 571
diff changeset
265 flushOffset = prevoffset;
563
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 560
diff changeset
266 if (rfb.isTreeManager() && rfb.connectionPresenter.isUseMulticast()) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 560
diff changeset
267 for (ByteBuffer buf : bufs)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 560
diff changeset
268 rfb.getViewer().getRfbBroadcastListener().multicastUpdateRectangle(buf);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 560
diff changeset
269 } else {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 560
diff changeset
270 rfb.multicastqueue.put(bufs);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 560
diff changeset
271 }
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
272 }
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
273 }
526
fcd833c2e148 Multicast Bloking in ZRLEDecoder
riono210
parents: 515
diff changeset
274
fcd833c2e148 Multicast Bloking in ZRLEDecoder
riono210
parents: 515
diff changeset
275 @Override
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
276 public void decode(Reader reader, Renderer renderer,
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
277 FramebufferUpdateRectangle rect) throws TransportException {
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
278 int zippedLength = (int) reader.readUInt32();
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 if (0 == zippedLength) return;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
280 int length = rect.width * rect.height * renderer.getBytesPerPixel();
577
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
281 ByteBuffer buf = unzip(reader, zippedLength, length, rect.getEncodingType());
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
282 decode1(renderer, null, rect, buf, zippedLength, null);
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
283 }
533
4be31e107121 fix bloking
riono210
parents: 532
diff changeset
284
4be31e107121 fix bloking
riono210
parents: 532
diff changeset
285
4be31e107121 fix bloking
riono210
parents: 532
diff changeset
286 public void multicastDecode(Reader reader, Renderer renderer,
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
287 FramebufferUpdateRectangle rect, TreeRFBProto rfb) throws TransportException {
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
288 ByteBuffer header = ByteBuffer.allocate(16);
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
289 reader.read(header.array());
533
4be31e107121 fix bloking
riono210
parents: 532
diff changeset
290 int zippedLength = (int) reader.readUInt32();
4be31e107121 fix bloking
riono210
parents: 532
diff changeset
291 if (0 == zippedLength) return;
4be31e107121 fix bloking
riono210
parents: 532
diff changeset
292 int length = rect.width * rect.height * renderer.getBytesPerPixel();
577
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
293 ByteBuffer buf = unzip(reader, zippedLength, length, rect.getEncodingType());
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
294 decode1(renderer, header, rect, buf, zippedLength, rfb);
533
4be31e107121 fix bloking
riono210
parents: 532
diff changeset
295 }
4be31e107121 fix bloking
riono210
parents: 532
diff changeset
296
577
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
297 public void decode1(Renderer renderer, ByteBuffer header, FramebufferUpdateRectangle rect, ByteBuffer buf, int zippedLength, TreeRFBProto rfbProto) throws TransportException {
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
298 int offset = zippedLength;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
299 int maxX = rect.x + rect.width;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
300 int maxY = rect.y + rect.height;
577
a236602a9191 fix multicastput
riono
parents: 576
diff changeset
301 byte[] bytes = buf.array();
528
2956c4a7bfbd define TileLoop class
anatofuz
parents: 527
diff changeset
302
566
e93a8058344d several fixes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
303 TileLoop tileloop = new TileLoop(rfbProto, zippedLength);
550
9c0cbe119155 fix make rectangle packet in client
e165729 <e165729@ie.u-ryukyu.ac.jp>
parents: 545
diff changeset
304 //System.out.println("decode1: "+rect.toString());
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
305 if (null == palette) {
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
306 palette = new int[128];
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
307 }
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
308 if (null == decodedBitmap) {
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
309 decodedBitmap = new int[MAX_TILE_SIZE * MAX_TILE_SIZE];
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
310 }
526
fcd833c2e148 Multicast Bloking in ZRLEDecoder
riono210
parents: 515
diff changeset
311
566
e93a8058344d several fixes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
312 if (rfbProto !=null && rfbProto.multicastBlocking) {
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
313 tileloop.zrleeBlocking(rfbProto, header, rect, bytes);
526
fcd833c2e148 Multicast Bloking in ZRLEDecoder
riono210
parents: 515
diff changeset
314 }
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
315 try {
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
316 for (int tileY = rect.y; tileY < maxY; tileY += MAX_TILE_SIZE) {
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
317 int tileHeight = Math.min(maxY - tileY, MAX_TILE_SIZE);
566
e93a8058344d several fixes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
318 if (tileloop.blocking)
e93a8058344d several fixes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
319 tileloop.c1rect.height += tileHeight;
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
320 for (int tileX = rect.x; tileX < maxX; tileX += MAX_TILE_SIZE) {
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
321 int tileWidth = Math.min(maxX - tileX, MAX_TILE_SIZE);
566
e93a8058344d several fixes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
322 if (tileloop.blocking && tileloop.c1rect.x + tileloop.c1rect.width < rect.x + rect.width)
564
0751cb6c0715 fix deflator
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 563
diff changeset
323 tileloop.c1rect.width += tileWidth;
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
324 int subencoding = bytes[offset++] & 0x0ff;
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
325 if (subencoding != 0)
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
326 System.out.println("----------------" + subencoding);
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
327 // 128 -plain RLE, 130-255 - Palette RLE
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
328 boolean isRle = (subencoding & 128) != 0;
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
329 // 2 to 16 for raw packed palette data, 130 to 255 for Palette RLE (subencoding - 128)
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
330 int paletteSize = subencoding & 127;
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
331 offset += readPalette(bytes, offset, renderer, paletteSize);
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
332 if (1 == subencoding) { // A solid tile consisting of a single colour
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
333 renderer.fillRect(palette[0], tileX, tileY, tileWidth, tileHeight);
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
334 } else if (isRle) {
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
335 if (0 == paletteSize) { // subencoding == 128 (or paletteSize == 0) - Plain RLE
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
336 offset += decodePlainRle(bytes, offset, renderer, tileX, tileY, tileWidth, tileHeight);
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
337 } else {
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
338 offset += decodePaletteRle(bytes, offset, renderer, tileX, tileY, tileWidth, tileHeight);
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
339 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
340 } else {
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
341 if (0 == paletteSize) { // subencoding == 0 (or paletteSize == 0) - raw CPIXEL data
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
342 offset += decodeRaw(bytes, offset, renderer, tileX, tileY, tileWidth, tileHeight);
63
84f1c39ba3bf temp commit
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 59
diff changeset
343 // System.out.println("offset:"+offset);
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
344 } else {
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
345 offset += decodePacked(bytes, offset, renderer, paletteSize, tileX, tileY, tileWidth, tileHeight);
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
346 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
347 }
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
348 if (rfbProto != null && rfbProto.multicastBlocking)
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
349 tileloop.multicastPut(rfbProto, false, bytes, offset, tileWidth, tileHeight);
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
350 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
351 }
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
352 if (rfbProto != null && rfbProto.multicastBlocking)
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
353 tileloop.multicastPut(rfbProto, true, bytes, offset, 0, 0);
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
354 } catch (Exception e) {
560
bdd659ce8e64 fix null renderer
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 552
diff changeset
355 e.printStackTrace();
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
356 if (rfbProto != null && rfbProto.multicastBlocking)
582
f01eef88010f new blocking scheme
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 581
diff changeset
357 tileloop.multicastPut(rfbProto, true, bytes, offset, 0, 0);
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
358 throw e;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
359 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
360 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
361
539
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
362
cb7c23cca231 fix ZRLEDecoder
riono
parents: 538
diff changeset
363
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
364 private int decodePlainRle(byte[] bytes, int offset, Renderer renderer,
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
365 int tileX, int tileY, int tileWidth, int tileHeight) {
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
366 int bytesPerCPixel = renderer.getBytesPerCPixel();
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
367 int decodedOffset = 0;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
368 int decodedEnd = tileWidth * tileHeight;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
369 int index = offset;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
370 while (decodedOffset < decodedEnd) {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
371 int color = renderer.getCompactPixelColor(bytes, index);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
372 index += bytesPerCPixel;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
373 int rlength = 1;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
374 do {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
375 rlength += bytes[index] & 0x0ff;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
376 } while ((bytes[index++] & 0x0ff) == 255);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
377 assert rlength <= decodedEnd - decodedOffset;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
378 renderer.fillColorBitmapWithColor(decodedBitmap, decodedOffset, rlength, color);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
379 decodedOffset += rlength;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
380 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
381 renderer.drawColoredBitmap(decodedBitmap, tileX, tileY, tileWidth, tileHeight);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
382 return index - offset;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
383 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
384
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
385 private int decodePaletteRle(byte[] bytes, int offset, Renderer renderer,
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
386 int tileX, int tileY, int tileWidth, int tileHeight) {
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
387 int decodedOffset = 0;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
388 int decodedEnd = tileWidth * tileHeight;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
389 int index = offset;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
390 while (decodedOffset < decodedEnd) {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
391 int colorIndex = bytes[index++];
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
392 int color = palette[colorIndex & 127];
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
393 int rlength = 1;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
394 if ((colorIndex & 128) != 0) {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
395 do {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
396 rlength += bytes[index] & 0x0ff;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
397 } while (bytes[index++] == (byte) 255);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
398 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
399 assert rlength <= decodedEnd - decodedOffset;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
400 renderer.fillColorBitmapWithColor(decodedBitmap, decodedOffset, rlength, color);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
401 decodedOffset += rlength;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
402 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
403 renderer.drawColoredBitmap(decodedBitmap, tileX, tileY, tileWidth, tileHeight);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
404 return index - offset;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
405 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
406
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
407 private int decodePacked(byte[] bytes, int offset, Renderer renderer,
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
408 int paletteSize, int tileX, int tileY, int tileWidth, int tileHeight) {
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
409 int bitsPerPalletedPixel = paletteSize > 16 ? 8 : paletteSize > 4 ? 4
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
410 : paletteSize > 2 ? 2 : 1;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
411 int packedOffset = offset;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
412 int decodedOffset = 0;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
413 for (int i = 0; i < tileHeight; ++i) {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
414 int decodedRowEnd = decodedOffset + tileWidth;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
415 int byteProcessed = 0;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
416 int bitsRemain = 0;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
417
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
418 while (decodedOffset < decodedRowEnd) {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
419 if (bitsRemain == 0) {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
420 byteProcessed = bytes[packedOffset++];
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
421 bitsRemain = 8;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
422 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
423 bitsRemain -= bitsPerPalletedPixel;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
424 int index = byteProcessed >> bitsRemain & (1 << bitsPerPalletedPixel) - 1 & 127;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
425 int color = palette[index];
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
426 renderer.fillColorBitmapWithColor(decodedBitmap, decodedOffset, 1, color);
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
427 ++decodedOffset;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
428 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
429 }
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
430 renderer.drawColoredBitmap(decodedBitmap, tileX, tileY, tileWidth, tileHeight);
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
431 return packedOffset - offset;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
432 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
433
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
434 private int decodeRaw(byte[] bytes, int offset, Renderer renderer,
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
435 int tileX, int tileY, int tileWidth, int tileHeight) throws TransportException {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
436 return renderer.drawCompactBytes(bytes, offset, tileX, tileY, tileWidth, tileHeight);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
437 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
438
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
439 private int readPalette(byte[] bytes, int offset, Renderer renderer, int paletteSize) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
440 final int bytesPerCPixel = renderer.getBytesPerCPixel();
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
441 for (int i=0; i<paletteSize; ++i) {
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
442 palette[i] = renderer.getCompactPixelColor(bytes, offset + i* bytesPerCPixel);
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
443 }
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
444 return paletteSize * bytesPerCPixel;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
445 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
446
526
fcd833c2e148 Multicast Bloking in ZRLEDecoder
riono210
parents: 515
diff changeset
447
fcd833c2e148 Multicast Bloking in ZRLEDecoder
riono210
parents: 515
diff changeset
448
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
449 }