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.4KB

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