summaryrefslogtreecommitdiffstats
path: root/common/rfb/CMsgReader.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2014-01-31 11:21:51 +0100
committerPierre Ossman <ossman@cendio.se>2014-07-07 14:42:08 +0200
commitd704e4ae77724abca7835f53390dacbfe1b09f9f (patch)
treeafeeea0cb8e54240ce7fc8648f92f12599af81f7 /common/rfb/CMsgReader.cxx
parent4aba19e287b0105bb47777762ce14b3786d91019 (diff)
downloadtigervnc-d704e4ae77724abca7835f53390dacbfe1b09f9f.tar.gz
tigervnc-d704e4ae77724abca7835f53390dacbfe1b09f9f.zip
Handle CopyRect like any other encoding
Avoids having to special case things. Keeps the code simpler.
Diffstat (limited to 'common/rfb/CMsgReader.cxx')
-rw-r--r--common/rfb/CMsgReader.cxx28
1 files changed, 8 insertions, 20 deletions
diff --git a/common/rfb/CMsgReader.cxx b/common/rfb/CMsgReader.cxx
index 8466c68c..b39fd099 100644
--- a/common/rfb/CMsgReader.cxx
+++ b/common/rfb/CMsgReader.cxx
@@ -198,35 +198,23 @@ void CMsgReader::readRect(const Rect& r, int encoding)
handler->beginRect(r, encoding);
- if (encoding == encodingCopyRect) {
- readCopyRect(r);
- } else {
+ if (!Decoder::supported(encoding)) {
+ fprintf(stderr, "Unknown rect encoding %d\n", encoding);
+ throw Exception("Unknown rect encoding");
+ }
- if (!Decoder::supported(encoding)) {
+ if (!decoders[encoding]) {
+ decoders[encoding] = Decoder::createDecoder(encoding, this);
+ if (!decoders[encoding]) {
fprintf(stderr, "Unknown rect encoding %d\n", encoding);
throw Exception("Unknown rect encoding");
}
-
- if (!decoders[encoding]) {
- decoders[encoding] = Decoder::createDecoder(encoding, this);
- if (!decoders[encoding]) {
- fprintf(stderr, "Unknown rect encoding %d\n", encoding);
- throw Exception("Unknown rect encoding");
- }
- }
- decoders[encoding]->readRect(r, handler);
}
+ decoders[encoding]->readRect(r, handler);
handler->endRect(r, encoding);
}
-void CMsgReader::readCopyRect(const Rect& r)
-{
- int srcX = is->readU16();
- int srcY = is->readU16();
- handler->copyRect(r, srcX, srcY);
-}
-
void CMsgReader::readSetCursor(int width, int height, const Point& hotspot)
{
int data_len = width * height * (handler->cp.pf().bpp/8);