blob: 028514a522cab91dfc665ee781351bf2cc78ef44 [file] [log] [blame]
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00001/* Copyright (C) 2000-2003 Constantin Kaplinsky. All Rights Reserved.
DRC33c15e32011-11-03 18:49:21 +00002 * Copyright (C) 2011 D. R. Commander. All Rights Reserved.
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00003 *
4 * This is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this software; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 * USA.
18 */
19#ifndef __RFB_TIGHTDECODER_H__
20#define __RFB_TIGHTDECODER_H__
21
22#include <rdr/ZlibInStream.h>
23#include <rfb/Decoder.h>
DRC33c15e32011-11-03 18:49:21 +000024#include <rfb/JpegDecompressor.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000025
26namespace rfb {
27
28 class TightDecoder : public Decoder {
DRC33c15e32011-11-03 18:49:21 +000029
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000030 public:
Pierre Ossman86350622015-11-10 13:02:12 +010031 TightDecoder();
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000032 virtual ~TightDecoder();
Pierre Ossman86350622015-11-10 13:02:12 +010033 virtual void readRect(const Rect& r, rdr::InStream* is,
34 const ConnParams& cp, ModifiablePixelBuffer* pb);
DRC33c15e32011-11-03 18:49:21 +000035
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000036 private:
Pierre Ossman7b5c0692014-03-17 14:35:51 +010037 rdr::U32 readCompact(rdr::InStream* is);
38
DRC33c15e32011-11-03 18:49:21 +000039 void tightDecode8(const Rect& r);
40 void tightDecode16(const Rect& r);
41 void tightDecode32(const Rect& r);
42
43 void DecompressJpegRect8(const Rect& r);
44 void DecompressJpegRect16(const Rect& r);
45 void DecompressJpegRect32(const Rect& r);
46
DRCa5004a32011-11-04 04:51:17 +000047 void FilterGradient8(rdr::U8 *netbuf, rdr::U8* buf, int stride,
48 const Rect& r);
49 void FilterGradient16(rdr::U8 *netbuf, rdr::U16* buf, int stride,
50 const Rect& r);
51 void FilterGradient24(rdr::U8 *netbuf, rdr::U32* buf, int stride,
52 const Rect& r);
53 void FilterGradient32(rdr::U8 *netbuf, rdr::U32* buf, int stride,
54 const Rect& r);
DRC33c15e32011-11-03 18:49:21 +000055
56 void directFillRect8(const Rect& r, Pixel pix);
57 void directFillRect16(const Rect& r, Pixel pix);
58 void directFillRect32(const Rect& r, Pixel pix);
59
Pierre Ossman0c9bd4b2014-07-09 16:44:11 +020060 ModifiablePixelBuffer* pb;
DRC33c15e32011-11-03 18:49:21 +000061 rdr::InStream* is;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000062 rdr::ZlibInStream zis[4];
DRC33c15e32011-11-03 18:49:21 +000063 JpegDecompressor jd;
64 PixelFormat clientpf;
65 PixelFormat serverpf;
66 bool directDecode;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000067 };
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000068}
69
70#endif