Mercurial > hg > Applications > TreeVNC
comparison src/main/java/com/glavsoft/rfb/encoding/decoder/RawDecoder.java @ 0:4689cc86d6cb
create TreeViewer2 Repository
author | Yu Taninari <you@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 03 Jul 2012 13:20:49 +0900 |
parents | |
children | 17b702648079 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4689cc86d6cb |
---|---|
1 // Copyright (C) 2010, 2011 GlavSoft LLC. | |
2 // All rights reserved. | |
3 // | |
4 //------------------------------------------------------------------------- | |
5 // This file is part of the TightVNC software. Please visit our Web site: | |
6 // | |
7 // http://www.tightvnc.com/ | |
8 // | |
9 // This program is free software; you can redistribute it and/or modify | |
10 // it under the terms of the GNU General Public License as published by | |
11 // the Free Software Foundation; either version 2 of the License, or | |
12 // (at your option) any later version. | |
13 // | |
14 // This program is distributed in the hope that it will be useful, | |
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 // GNU General Public License for more details. | |
18 // | |
19 // You should have received a copy of the GNU General Public License along | |
20 // with this program; if not, write to the Free Software Foundation, Inc., | |
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
22 //------------------------------------------------------------------------- | |
23 // | |
24 | |
25 package com.glavsoft.rfb.encoding.decoder; | |
26 | |
27 import com.glavsoft.drawing.Renderer; | |
28 import com.glavsoft.exceptions.TransportException; | |
29 import com.glavsoft.transport.Reader; | |
30 | |
31 public class RawDecoder extends Decoder { | |
32 private static RawDecoder instance = new RawDecoder(); | |
33 public static RawDecoder getInstance() { | |
34 return instance; | |
35 } | |
36 private RawDecoder() { /*empty*/ } | |
37 | |
38 @Override | |
39 public void decode(Reader reader, | |
40 Renderer renderer, FramebufferUpdateRectangle rect) throws TransportException { | |
41 decode(reader, renderer, rect.x, rect.y, rect.width, rect.height); | |
42 } | |
43 | |
44 public void decode(Reader reader, Renderer renderer, int x, int y, | |
45 int width, int height) throws TransportException { | |
46 int length = width * height * renderer.getBytesPerPixel(); | |
47 byte [] bytes = ByteBuffer.getInstance().getBuffer(length); | |
48 reader.readBytes(bytes, 0, length); | |
49 renderer.drawBytes(bytes, x, y, width, height); | |
50 } | |
51 | |
52 } |