aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2014-01-21 14:45:10 +0100
committerPierre Ossman <ossman@cendio.se>2014-07-07 14:42:08 +0200
commit717c07b9671badeef0c18c91cf17fe9747559787 (patch)
treed4ad9cfc9e04cb0453118869c5cfe2ec660320f7
parentc0b1aa021dff606c32aed0f1ac38ab51baf093af (diff)
downloadtigervnc-717c07b9671badeef0c18c91cf17fe9747559787.tar.gz
tigervnc-717c07b9671badeef0c18c91cf17fe9747559787.zip
Remove partial update functionality
Get rid of the ability of encoders to only send part of the rectangle they are given as we don't want partial updates anyway.
-rw-r--r--common/rfb/Encoder.h9
-rw-r--r--common/rfb/HextileEncoder.cxx4
-rw-r--r--common/rfb/HextileEncoder.h2
-rw-r--r--common/rfb/RREEncoder.cxx6
-rw-r--r--common/rfb/RREEncoder.h2
-rw-r--r--common/rfb/RawEncoder.cxx3
-rw-r--r--common/rfb/RawEncoder.h2
-rw-r--r--common/rfb/SMsgWriter.cxx23
-rw-r--r--common/rfb/SMsgWriter.h16
-rw-r--r--common/rfb/TightEncoder.cxx15
-rw-r--r--common/rfb/TightEncoder.h2
-rw-r--r--common/rfb/VNCSConnectionST.cxx8
-rw-r--r--common/rfb/ZRLEEncoder.cxx17
-rw-r--r--common/rfb/ZRLEEncoder.h2
-rw-r--r--common/rfb/zrleEncode.h15
15 files changed, 46 insertions, 80 deletions
diff --git a/common/rfb/Encoder.h b/common/rfb/Encoder.h
index 26d57963..8712c09a 100644
--- a/common/rfb/Encoder.h
+++ b/common/rfb/Encoder.h
@@ -36,11 +36,10 @@ namespace rfb {
virtual void setFineQualityLevel(int quality, int subsampling) {};
virtual int getNumRects(const Rect &r) { return 1; }
- // writeRect() tries to write the given rectangle. If it is unable to
- // write the whole rectangle it returns false and sets actual to the actual
- // rectangle which was updated.
- virtual bool writeRect(const Rect& r, TransImageGetter* ig,
- Rect* actual)=0;
+ // writeRect() is the main interface that encodes the given rectangle
+ // with data from the ImageGetter onto the SMsgWriter given at
+ // encoder creation.
+ virtual void writeRect(const Rect& r, TransImageGetter* ig)=0;
static bool supported(int encoding);
static Encoder* createEncoder(int encoding, SMsgWriter* writer);
diff --git a/common/rfb/HextileEncoder.cxx b/common/rfb/HextileEncoder.cxx
index 0907bab8..19fb1a3e 100644
--- a/common/rfb/HextileEncoder.cxx
+++ b/common/rfb/HextileEncoder.cxx
@@ -53,8 +53,7 @@ HextileEncoder::~HextileEncoder()
{
}
-bool HextileEncoder::writeRect(const Rect& r, TransImageGetter* ig,
- Rect* actual)
+void HextileEncoder::writeRect(const Rect& r, TransImageGetter* ig)
{
writer->startRect(r, encodingHextile);
rdr::OutStream* os = writer->getOutStream();
@@ -82,5 +81,4 @@ bool HextileEncoder::writeRect(const Rect& r, TransImageGetter* ig,
break;
}
writer->endRect();
- return true;
}
diff --git a/common/rfb/HextileEncoder.h b/common/rfb/HextileEncoder.h
index 0c475a8e..5540c642 100644
--- a/common/rfb/HextileEncoder.h
+++ b/common/rfb/HextileEncoder.h
@@ -26,7 +26,7 @@ namespace rfb {
public:
HextileEncoder(SMsgWriter* writer);
virtual ~HextileEncoder();
- virtual bool writeRect(const Rect& r, TransImageGetter* ig, Rect* actual);
+ virtual void writeRect(const Rect& r, TransImageGetter* ig);
private:
SMsgWriter* writer;
};
diff --git a/common/rfb/RREEncoder.cxx b/common/rfb/RREEncoder.cxx
index 36d46955..09702cf7 100644
--- a/common/rfb/RREEncoder.cxx
+++ b/common/rfb/RREEncoder.cxx
@@ -41,7 +41,7 @@ RREEncoder::~RREEncoder()
{
}
-bool RREEncoder::writeRect(const Rect& r, TransImageGetter* ig, Rect* actual)
+void RREEncoder::writeRect(const Rect& r, TransImageGetter* ig)
{
int w = r.width();
int h = r.height();
@@ -58,7 +58,8 @@ bool RREEncoder::writeRect(const Rect& r, TransImageGetter* ig, Rect* actual)
}
if (nSubrects < 0) {
- return writer->writeRect(r, encodingRaw, ig, actual);
+ writer->writeRect(r, encodingRaw, ig);
+ return;
}
writer->startRect(r, encodingRRE);
@@ -66,5 +67,4 @@ bool RREEncoder::writeRect(const Rect& r, TransImageGetter* ig, Rect* actual)
os->writeU32(nSubrects);
os->writeBytes(mos.data(), mos.length());
writer->endRect();
- return true;
}
diff --git a/common/rfb/RREEncoder.h b/common/rfb/RREEncoder.h
index f7d576eb..4b990f5b 100644
--- a/common/rfb/RREEncoder.h
+++ b/common/rfb/RREEncoder.h
@@ -27,7 +27,7 @@ namespace rfb {
public:
RREEncoder(SMsgWriter* writer);
virtual ~RREEncoder();
- virtual bool writeRect(const Rect& r, TransImageGetter* ig, Rect* actual);
+ virtual void writeRect(const Rect& r, TransImageGetter* ig);
private:
SMsgWriter* writer;
rdr::MemOutStream mos;
diff --git a/common/rfb/RawEncoder.cxx b/common/rfb/RawEncoder.cxx
index 4b8de6ba..b4e38dbf 100644
--- a/common/rfb/RawEncoder.cxx
+++ b/common/rfb/RawEncoder.cxx
@@ -31,7 +31,7 @@ RawEncoder::~RawEncoder()
{
}
-bool RawEncoder::writeRect(const Rect& r, TransImageGetter* ig, Rect* actual)
+void RawEncoder::writeRect(const Rect& r, TransImageGetter* ig)
{
int x = r.tl.x;
int y = r.tl.y;
@@ -50,5 +50,4 @@ bool RawEncoder::writeRect(const Rect& r, TransImageGetter* ig, Rect* actual)
y += nRows;
}
writer->endRect();
- return true;
}
diff --git a/common/rfb/RawEncoder.h b/common/rfb/RawEncoder.h
index 22d45dbf..628f32fd 100644
--- a/common/rfb/RawEncoder.h
+++ b/common/rfb/RawEncoder.h
@@ -26,7 +26,7 @@ namespace rfb {
public:
RawEncoder(SMsgWriter* writer);
virtual ~RawEncoder();
- virtual bool writeRect(const Rect& r, TransImageGetter* ig, Rect* actual);
+ virtual void writeRect(const Rect& r, TransImageGetter* ig);
private:
SMsgWriter* writer;
};
diff --git a/common/rfb/SMsgWriter.cxx b/common/rfb/SMsgWriter.cxx
index 2a31f03e..615eaa93 100644
--- a/common/rfb/SMsgWriter.cxx
+++ b/common/rfb/SMsgWriter.cxx
@@ -291,26 +291,18 @@ void SMsgWriter::writeNoDataUpdate()
writeFramebufferUpdateEnd();
}
-void SMsgWriter::writeRects(const UpdateInfo& ui, TransImageGetter* ig,
- Region* updatedRegion)
+void SMsgWriter::writeRects(const UpdateInfo& ui, TransImageGetter* ig)
{
std::vector<Rect> rects;
std::vector<Rect>::const_iterator i;
- updatedRegion->copyFrom(ui.changed);
- updatedRegion->assign_union(ui.copied);
ui.copied.get_rects(&rects, ui.copy_delta.x <= 0, ui.copy_delta.y <= 0);
for (i = rects.begin(); i != rects.end(); i++)
writeCopyRect(*i, i->tl.x - ui.copy_delta.x, i->tl.y - ui.copy_delta.y);
ui.changed.get_rects(&rects);
- for (i = rects.begin(); i != rects.end(); i++) {
- Rect actual;
- if (!writeRect(*i, ig, &actual)) {
- updatedRegion->assign_subtract(*i);
- updatedRegion->assign_union(actual);
- }
- }
+ for (i = rects.begin(); i != rects.end(); i++)
+ writeRect(*i, ig);
}
void SMsgWriter::writeFramebufferUpdateStart(int nRects)
@@ -355,19 +347,18 @@ void SMsgWriter::writeFramebufferUpdateEnd()
endMsg();
}
-bool SMsgWriter::writeRect(const Rect& r, TransImageGetter* ig, Rect* actual)
+void SMsgWriter::writeRect(const Rect& r, TransImageGetter* ig)
{
- return writeRect(r, cp->currentEncoding(), ig, actual);
+ writeRect(r, cp->currentEncoding(), ig);
}
-bool SMsgWriter::writeRect(const Rect& r, int encoding,
- TransImageGetter* ig, Rect* actual)
+void SMsgWriter::writeRect(const Rect& r, int encoding, TransImageGetter* ig)
{
if (!encoders[encoding]) {
encoders[encoding] = Encoder::createEncoder(encoding, this);
assert(encoders[encoding]);
}
- return encoders[encoding]->writeRect(r, ig, actual);
+ encoders[encoding]->writeRect(r, ig);
}
void SMsgWriter::writeCopyRect(const Rect& r, int srcX, int srcY)
diff --git a/common/rfb/SMsgWriter.h b/common/rfb/SMsgWriter.h
index 01141af3..5d45411d 100644
--- a/common/rfb/SMsgWriter.h
+++ b/common/rfb/SMsgWriter.h
@@ -122,10 +122,8 @@ namespace rfb {
// ImageGetter to fetch pixels from. It then calls writeCopyRect() and
// writeRect() as appropriate. writeFramebufferUpdateStart() must be used
// before the first writeRects() call and writeFrameBufferUpdateEnd() after
- // the last one. It returns the actual region sent to the client, which
- // may be smaller than the update passed in.
- void writeRects(const UpdateInfo& update, TransImageGetter* ig,
- Region* updatedRegion);
+ // the last one.
+ void writeRects(const UpdateInfo& update, TransImageGetter* ig);
// To construct a framebuffer update you can call
// writeFramebufferUpdateStart(), followed by a number of writeCopyRect()s
@@ -133,12 +131,10 @@ namespace rfb {
void writeFramebufferUpdateStart(int nRects);
void writeFramebufferUpdateEnd();
- // writeRect() tries to write the given rectangle. If it is unable to
- // write the whole rectangle it returns false and sets actual to the actual
- // rectangle which was updated.
- bool writeRect(const Rect& r, TransImageGetter* ig, Rect* actual);
- bool writeRect(const Rect& r, int encoding,
- TransImageGetter* ig, Rect* actual);
+ // writeRect() writers the given rectangle using either the preferred
+ // encoder, or the one explicitly given.
+ void writeRect(const Rect& r, TransImageGetter* ig);
+ void writeRect(const Rect& r, int encoding, TransImageGetter* ig);
void writeCopyRect(const Rect& r, int srcX, int srcY);
diff --git a/common/rfb/TightEncoder.cxx b/common/rfb/TightEncoder.cxx
index 1cff7a60..f4633f88 100644
--- a/common/rfb/TightEncoder.cxx
+++ b/common/rfb/TightEncoder.cxx
@@ -286,8 +286,7 @@ void TightEncoder::sendRectSimple(const Rect& r)
}
}
-bool TightEncoder::writeRect(const Rect& _r, TransImageGetter* _ig,
- Rect* actual)
+void TightEncoder::writeRect(const Rect& _r, TransImageGetter* _ig)
{
ig = _ig;
serverpf = ig->getPixelBuffer()->getPF();
@@ -304,7 +303,7 @@ bool TightEncoder::writeRect(const Rect& _r, TransImageGetter* _ig,
// Encode small rects as is.
if (!cp->supportsLastRect || w * h < TIGHT_MIN_SPLIT_RECT_SIZE) {
sendRectSimple(r);
- return true;
+ return;
}
// Split big rects into separately encoded subrects.
@@ -366,7 +365,7 @@ bool TightEncoder::writeRect(const Rect& _r, TransImageGetter* _ig,
}
if (bestr.tl.x != x) {
sr.setXYWH(x, bestr.tl.y, bestr.tl.x - x, bestr.height());
- writeRect(sr, _ig, NULL);
+ writeRect(sr, _ig);
}
// Send solid-color rectangle.
@@ -376,21 +375,21 @@ bool TightEncoder::writeRect(const Rect& _r, TransImageGetter* _ig,
if (bestr.br.x != r.br.x) {
sr.setXYWH(bestr.br.x, bestr.tl.y, r.br.x - bestr.br.x,
bestr.height());
- writeRect(sr, _ig, NULL);
+ writeRect(sr, _ig);
}
if (bestr.br.y != r.br.y) {
sr.setXYWH(x, bestr.br.y, w, r.br.y - bestr.br.y);
- writeRect(sr, _ig, NULL);
+ writeRect(sr, _ig);
}
- return true;
+ return;
}
}
}
// No suitable solid-color rectangles found.
sendRectSimple(r);
- return true;
+ return;
}
void TightEncoder::writeSubrect(const Rect& r, bool forceSolid)
diff --git a/common/rfb/TightEncoder.h b/common/rfb/TightEncoder.h
index 3632539d..a499783d 100644
--- a/common/rfb/TightEncoder.h
+++ b/common/rfb/TightEncoder.h
@@ -86,7 +86,7 @@ namespace rfb {
virtual void setQualityLevel(int level);
virtual void setFineQualityLevel(int quality, int subsampling);
virtual int getNumRects(const Rect &r);
- virtual bool writeRect(const Rect& r, TransImageGetter* ig, Rect* actual);
+ virtual void writeRect(const Rect& r, TransImageGetter* ig);
private:
bool checkSolidTile(Rect& r, rdr::U32* colorPtr, bool needSameColor);
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx
index 381ee216..9b6b594b 100644
--- a/common/rfb/VNCSConnectionST.cxx
+++ b/common/rfb/VNCSConnectionST.cxx
@@ -1102,9 +1102,8 @@ void VNCSConnectionST::writeFramebufferUpdate()
writer()->writeFramebufferUpdateStart(nRects);
- Region updatedRegion;
- writer()->writeRects(ui, &image_getter, &updatedRegion);
- updates.subtract(updatedRegion);
+ writer()->writeRects(ui, &image_getter);
+ updates.clear();
if (drawRenderedCursor)
writeRenderedCursorRect();
@@ -1129,8 +1128,7 @@ void VNCSConnectionST::writeRenderedCursorRect()
image_getter.setPixelBuffer(&server->renderedCursor);
image_getter.setOffset(server->renderedCursorTL);
- Rect actual;
- writer()->writeRect(renderedCursorRect, &image_getter, &actual);
+ writer()->writeRect(renderedCursorRect, &image_getter);
image_getter.setPixelBuffer(server->pb);
image_getter.setOffset(Point(0,0));
diff --git a/common/rfb/ZRLEEncoder.cxx b/common/rfb/ZRLEEncoder.cxx
index e70706b5..7e00fad2 100644
--- a/common/rfb/ZRLEEncoder.cxx
+++ b/common/rfb/ZRLEEncoder.cxx
@@ -55,19 +55,17 @@ ZRLEEncoder::~ZRLEEncoder()
{
}
-bool ZRLEEncoder::writeRect(const Rect& r, TransImageGetter* ig, Rect* actual)
+void ZRLEEncoder::writeRect(const Rect& r, TransImageGetter* ig)
{
rdr::U8* imageBuf = writer->getImageBuf(64 * 64 * 4 + 4);
mos.clear();
- bool wroteAll = true;
- *actual = r;
switch (writer->bpp()) {
case 8:
- wroteAll = zrleEncode8(r, &mos, &zos, imageBuf, actual, ig);
+ zrleEncode8(r, &mos, &zos, imageBuf, ig);
break;
case 16:
- wroteAll = zrleEncode16(r, &mos, &zos, imageBuf, actual, ig);
+ zrleEncode16(r, &mos, &zos, imageBuf, ig);
break;
case 32:
{
@@ -80,25 +78,24 @@ bool ZRLEEncoder::writeRect(const Rect& r, TransImageGetter* ig, Rect* actual)
if ((fitsInLS3Bytes && pf.isLittleEndian()) ||
(fitsInMS3Bytes && pf.isBigEndian()))
{
- wroteAll = zrleEncode24A(r, &mos, &zos, imageBuf, actual, ig);
+ zrleEncode24A(r, &mos, &zos, imageBuf, ig);
}
else if ((fitsInLS3Bytes && pf.isBigEndian()) ||
(fitsInMS3Bytes && pf.isLittleEndian()))
{
- wroteAll = zrleEncode24B(r, &mos, &zos, imageBuf, actual, ig);
+ zrleEncode24B(r, &mos, &zos, imageBuf, ig);
}
else
{
- wroteAll = zrleEncode32(r, &mos, &zos, imageBuf, actual, ig);
+ zrleEncode32(r, &mos, &zos, imageBuf, ig);
}
break;
}
}
- writer->startRect(*actual, encodingZRLE);
+ writer->startRect(r, encodingZRLE);
rdr::OutStream* os = writer->getOutStream();
os->writeU32(mos.length());
os->writeBytes(mos.data(), mos.length());
writer->endRect();
- return wroteAll;
}
diff --git a/common/rfb/ZRLEEncoder.h b/common/rfb/ZRLEEncoder.h
index e3517c13..acc6d362 100644
--- a/common/rfb/ZRLEEncoder.h
+++ b/common/rfb/ZRLEEncoder.h
@@ -28,7 +28,7 @@ namespace rfb {
public:
ZRLEEncoder(SMsgWriter* writer);
virtual ~ZRLEEncoder();
- virtual bool writeRect(const Rect& r, TransImageGetter* ig, Rect* actual);
+ virtual void writeRect(const Rect& r, TransImageGetter* ig);
private:
SMsgWriter* writer;
rdr::ZlibOutStream zos;
diff --git a/common/rfb/zrleEncode.h b/common/rfb/zrleEncode.h
index 0c622b88..928ce967 100644
--- a/common/rfb/zrleEncode.h
+++ b/common/rfb/zrleEncode.h
@@ -114,8 +114,8 @@ public:
void ZRLE_ENCODE_TILE (PIXEL_T* data, int w, int h, rdr::OutStream* os);
-bool ZRLE_ENCODE (const Rect& r, rdr::OutStream* os,
- rdr::ZlibOutStream* zos, void* buf, Rect* actual
+void ZRLE_ENCODE (const Rect& r, rdr::OutStream* os,
+ rdr::ZlibOutStream* zos, void* buf
#ifdef EXTRA_ARGS
, EXTRA_ARGS
#endif
@@ -132,16 +132,6 @@ bool ZRLE_ENCODE (const Rect& r, rdr::OutStream* os,
t.br.y = __rfbmin(r.br.y, t.tl.y + 64);
- // enough for width 16384 32-bit pixels
- if (os->length() + worstCaseLine > 4097 * 1024) {
- if (t.tl.y == r.tl.y)
- throw Exception("ZRLE: not enough space for first line?");
- actual->tl = r.tl;
- actual->br.x = r.br.x;
- actual->br.y = t.tl.y;
- return false;
- }
-
for (t.tl.x = r.tl.x; t.tl.x < r.br.x; t.tl.x += 64) {
t.br.x = __rfbmin(r.br.x, t.tl.x + 64);
@@ -153,7 +143,6 @@ bool ZRLE_ENCODE (const Rect& r, rdr::OutStream* os,
zos->flush();
}
- return true;
}