Avoids having to special case things. Keeps the code simpler.
ComparingUpdateTracker.cxx
Configuration.cxx
ConnParams.cxx
+ CopyRectDecoder.cxx
Cursor.cxx
Decoder.cxx
d3des.c
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);
void readFramebufferUpdate();
void readRect(const Rect& r, int encoding);
- void readCopyRect(const Rect& r);
void readSetCursor(int width, int height, const Point& hotspot);
void readSetDesktopName(int x, int y, int w, int h);
// Remaining encodings
for (int i = encodingMax; i >= 0; i--) {
switch (i) {
+ case encodingCopyRect:
case encodingTight:
case encodingZRLE:
case encodingHextile:
+ /* These have already been sent earlier */
break;
default:
if ((i != preferredEncoding) && Decoder::supported(i))
--- /dev/null
+/* Copyright 2014 Pierre Ossman <ossman@cendio.se> for Cendio AB
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ * USA.
+ */
+#include <rdr/InStream.h>
+#include <rfb/CMsgReader.h>
+#include <rfb/CMsgHandler.h>
+#include <rfb/PixelBuffer.h>
+#include <rfb/CopyRectDecoder.h>
+
+using namespace rfb;
+
+CopyRectDecoder::CopyRectDecoder(CMsgReader* reader) : Decoder(reader)
+{
+}
+
+CopyRectDecoder::~CopyRectDecoder()
+{
+}
+
+void CopyRectDecoder::readRect(const Rect& r, CMsgHandler* handler)
+{
+ int srcX = reader->getInStream()->readU16();
+ int srcY = reader->getInStream()->readU16();
+ handler->copyRect(r, srcX, srcY);
+}
--- /dev/null
+/* Copyright 2014 Pierre Ossman <ossman@cendio.se> for Cendio AB
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ * USA.
+ */
+#ifndef __RFB_COPYRECTDECODER_H__
+#define __RFB_COPYRECTDECODER_H__
+
+#include <rfb/Decoder.h>
+
+namespace rfb {
+
+ class CopyRectDecoder : public Decoder {
+ public:
+ CopyRectDecoder(CMsgReader* reader);
+ virtual ~CopyRectDecoder();
+ virtual void readRect(const Rect& r, CMsgHandler* handler);
+ };
+}
+#endif
#include <rfb/encodings.h>
#include <rfb/Decoder.h>
#include <rfb/RawDecoder.h>
+#include <rfb/CopyRectDecoder.h>
#include <rfb/RREDecoder.h>
#include <rfb/HextileDecoder.h>
#include <rfb/ZRLEDecoder.h>
{
switch (encoding) {
case encodingRaw:
+ case encodingCopyRect:
case encodingRRE:
case encodingHextile:
case encodingZRLE:
switch (encoding) {
case encodingRaw:
return new RawDecoder(reader);
+ case encodingCopyRect:
+ return new CopyRectDecoder(reader);
case encodingRRE:
return new RREDecoder(reader);
case encodingHextile: