blob: 28b6c30fd48628975357cf9bf6fe4d58aa05df0a [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.
Pierre Ossman80b42092015-11-10 17:17:34 +01003 * Copyright 2009-2015 Pierre Ossman for Cendio AB
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00004 *
5 * This is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This software is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this software; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18 * USA.
19 */
20#ifndef __RFB_TIGHTDECODER_H__
21#define __RFB_TIGHTDECODER_H__
22
23#include <rdr/ZlibInStream.h>
24#include <rfb/Decoder.h>
DRC33c15e32011-11-03 18:49:21 +000025#include <rfb/JpegDecompressor.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000026
27namespace rfb {
28
29 class TightDecoder : public Decoder {
DRC33c15e32011-11-03 18:49:21 +000030
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000031 public:
Pierre Ossman86350622015-11-10 13:02:12 +010032 TightDecoder();
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000033 virtual ~TightDecoder();
Pierre Ossman86350622015-11-10 13:02:12 +010034 virtual void readRect(const Rect& r, rdr::InStream* is,
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020035 const ServerParams& server, rdr::OutStream* os);
Pierre Ossmane6ad4452015-11-13 10:47:28 +010036 virtual bool doRectsConflict(const Rect& rectA,
37 const void* bufferA,
38 size_t buflenA,
39 const Rect& rectB,
40 const void* bufferB,
41 size_t buflenB,
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020042 const ServerParams& server);
Pierre Ossman80b42092015-11-10 17:17:34 +010043 virtual void decodeRect(const Rect& r, const void* buffer,
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020044 size_t buflen, const ServerParams& server,
Pierre Ossman80b42092015-11-10 17:17:34 +010045 ModifiablePixelBuffer* pb);
DRC33c15e32011-11-03 18:49:21 +000046
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000047 private:
Pierre Ossman7b5c0692014-03-17 14:35:51 +010048 rdr::U32 readCompact(rdr::InStream* is);
49
Pierre Ossman80b42092015-11-10 17:17:34 +010050 void FilterGradient24(const rdr::U8* inbuf, const PixelFormat& pf,
51 rdr::U32* outbuf, int stride, const Rect& r);
DRC33c15e32011-11-03 18:49:21 +000052
Pierre Ossman80b42092015-11-10 17:17:34 +010053 void FilterGradient(const rdr::U8* inbuf, const PixelFormat& pf,
54 rdr::U16* outbuf, int stride, const Rect& r);
55 void FilterGradient(const rdr::U8* inbuf, const PixelFormat& pf,
56 rdr::U32* outbuf, int stride, const Rect& r);
DRC33c15e32011-11-03 18:49:21 +000057
Pierre Ossman80b42092015-11-10 17:17:34 +010058 void FilterPalette(const rdr::U8* palette, int palSize,
59 const rdr::U8* inbuf, rdr::U8* outbuf,
60 int stride, const Rect& r);
61 void FilterPalette(const rdr::U16* palette, int palSize,
62 const rdr::U8* inbuf, rdr::U16* outbuf,
63 int stride, const Rect& r);
64 void FilterPalette(const rdr::U32* palette, int palSize,
65 const rdr::U8* inbuf, rdr::U32* outbuf,
66 int stride, const Rect& r);
DRC33c15e32011-11-03 18:49:21 +000067
Pierre Ossman80b42092015-11-10 17:17:34 +010068 private:
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000069 rdr::ZlibInStream zis[4];
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000070 };
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000071}
72
73#endif