Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2000-2003 Constantin Kaplinsky. All Rights Reserved. |
DRC | 33c15e3 | 2011-11-03 18:49:21 +0000 | [diff] [blame] | 2 | * Copyright (C) 2011 D. R. Commander. All Rights Reserved. |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 3 | * |
| 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> |
DRC | 33c15e3 | 2011-11-03 18:49:21 +0000 | [diff] [blame] | 24 | #include <rfb/JpegDecompressor.h> |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 25 | |
| 26 | namespace rfb { |
| 27 | |
| 28 | class TightDecoder : public Decoder { |
DRC | 33c15e3 | 2011-11-03 18:49:21 +0000 | [diff] [blame] | 29 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 30 | public: |
Pierre Ossman | 8635062 | 2015-11-10 13:02:12 +0100 | [diff] [blame^] | 31 | TightDecoder(); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 32 | virtual ~TightDecoder(); |
Pierre Ossman | 8635062 | 2015-11-10 13:02:12 +0100 | [diff] [blame^] | 33 | virtual void readRect(const Rect& r, rdr::InStream* is, |
| 34 | const ConnParams& cp, ModifiablePixelBuffer* pb); |
DRC | 33c15e3 | 2011-11-03 18:49:21 +0000 | [diff] [blame] | 35 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 36 | private: |
Pierre Ossman | 7b5c069 | 2014-03-17 14:35:51 +0100 | [diff] [blame] | 37 | rdr::U32 readCompact(rdr::InStream* is); |
| 38 | |
DRC | 33c15e3 | 2011-11-03 18:49:21 +0000 | [diff] [blame] | 39 | 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 | |
DRC | a5004a3 | 2011-11-04 04:51:17 +0000 | [diff] [blame] | 47 | 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); |
DRC | 33c15e3 | 2011-11-03 18:49:21 +0000 | [diff] [blame] | 55 | |
| 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 Ossman | 0c9bd4b | 2014-07-09 16:44:11 +0200 | [diff] [blame] | 60 | ModifiablePixelBuffer* pb; |
DRC | 33c15e3 | 2011-11-03 18:49:21 +0000 | [diff] [blame] | 61 | rdr::InStream* is; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 62 | rdr::ZlibInStream zis[4]; |
DRC | 33c15e3 | 2011-11-03 18:49:21 +0000 | [diff] [blame] | 63 | JpegDecompressor jd; |
| 64 | PixelFormat clientpf; |
| 65 | PixelFormat serverpf; |
| 66 | bool directDecode; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 67 | }; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | #endif |