You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TightDecoder.h 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* Copyright (C) 2000-2003 Constantin Kaplinsky. All Rights Reserved.
  2. * Copyright (C) 2011 D. R. Commander. All Rights Reserved.
  3. * Copyright 2009-2015 Pierre Ossman for Cendio AB
  4. *
  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. #include <rdr/ZlibInStream.h>
  23. #include <rfb/Decoder.h>
  24. #include <rfb/JpegDecompressor.h>
  25. namespace rfb {
  26. class TightDecoder : public Decoder {
  27. public:
  28. TightDecoder();
  29. virtual ~TightDecoder();
  30. virtual void readRect(const Rect& r, rdr::InStream* is,
  31. const ServerParams& server, rdr::OutStream* os);
  32. virtual bool doRectsConflict(const Rect& rectA,
  33. const void* bufferA,
  34. size_t buflenA,
  35. const Rect& rectB,
  36. const void* bufferB,
  37. size_t buflenB,
  38. const ServerParams& server);
  39. virtual void decodeRect(const Rect& r, const void* buffer,
  40. size_t buflen, const ServerParams& server,
  41. ModifiablePixelBuffer* pb);
  42. private:
  43. rdr::U32 readCompact(rdr::InStream* is);
  44. void FilterGradient24(const rdr::U8* inbuf, const PixelFormat& pf,
  45. rdr::U32* outbuf, int stride, const Rect& r);
  46. void FilterGradient(const rdr::U8* inbuf, const PixelFormat& pf,
  47. rdr::U16* outbuf, int stride, const Rect& r);
  48. void FilterGradient(const rdr::U8* inbuf, const PixelFormat& pf,
  49. rdr::U32* outbuf, int stride, const Rect& r);
  50. void FilterPalette(const rdr::U8* palette, int palSize,
  51. const rdr::U8* inbuf, rdr::U8* outbuf,
  52. int stride, const Rect& r);
  53. void FilterPalette(const rdr::U16* palette, int palSize,
  54. const rdr::U8* inbuf, rdr::U16* outbuf,
  55. int stride, const Rect& r);
  56. void FilterPalette(const rdr::U32* palette, int palSize,
  57. const rdr::U8* inbuf, rdr::U32* outbuf,
  58. int stride, const Rect& r);
  59. private:
  60. rdr::ZlibInStream zis[4];
  61. };
  62. }
  63. #endif