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.

Decoder.cxx 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright 2014 Pierre Ossman for Cendio AB
  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. #include <stdio.h>
  20. #include <rfb/encodings.h>
  21. #include <rfb/Region.h>
  22. #include <rfb/Decoder.h>
  23. #include <rfb/RawDecoder.h>
  24. #include <rfb/CopyRectDecoder.h>
  25. #include <rfb/RREDecoder.h>
  26. #include <rfb/HextileDecoder.h>
  27. #include <rfb/ZRLEDecoder.h>
  28. #include <rfb/TightDecoder.h>
  29. using namespace rfb;
  30. Decoder::Decoder(enum DecoderFlags flags) : flags(flags)
  31. {
  32. }
  33. Decoder::~Decoder()
  34. {
  35. }
  36. void Decoder::getAffectedRegion(const Rect& rect, const void* buffer,
  37. size_t buflen, const ServerParams& server,
  38. Region* region)
  39. {
  40. region->reset(rect);
  41. }
  42. bool Decoder::doRectsConflict(const Rect& rectA, const void* bufferA,
  43. size_t buflenA, const Rect& rectB,
  44. const void* bufferB, size_t buflenB,
  45. const ServerParams& server)
  46. {
  47. return false;
  48. }
  49. bool Decoder::supported(int encoding)
  50. {
  51. switch (encoding) {
  52. case encodingRaw:
  53. case encodingCopyRect:
  54. case encodingRRE:
  55. case encodingHextile:
  56. case encodingZRLE:
  57. case encodingTight:
  58. return true;
  59. default:
  60. return false;
  61. }
  62. }
  63. Decoder* Decoder::createDecoder(int encoding)
  64. {
  65. switch (encoding) {
  66. case encodingRaw:
  67. return new RawDecoder();
  68. case encodingCopyRect:
  69. return new CopyRectDecoder();
  70. case encodingRRE:
  71. return new RREDecoder();
  72. case encodingHextile:
  73. return new HextileDecoder();
  74. case encodingZRLE:
  75. return new ZRLEDecoder();
  76. case encodingTight:
  77. return new TightDecoder();
  78. default:
  79. return NULL;
  80. }
  81. }