summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordscho <dscho>2001-10-16 23:11:37 +0000
committerdscho <dscho>2001-10-16 23:11:37 +0000
commit8e9f427a779eda4fe89d39b254a6ed475155dd00 (patch)
tree1782a88e4d4a2fa436817c267a8387a24d12e07a
parent2c4869fc9a8f2c72e6f8631b25894246a0a90701 (diff)
downloadlibtdevnc-8e9f427a779eda4fe89d39b254a6ed475155dd00.tar.gz
libtdevnc-8e9f427a779eda4fe89d39b254a6ed475155dd00.zip
scheduleCopyRegion no longer sends frameBufferUpdates (no longer clobbers
deferring)
-rw-r--r--main.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/main.c b/main.c
index 7be9191..db705ed 100644
--- a/main.c
+++ b/main.c
@@ -76,21 +76,39 @@ void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,in
LOCK(cl->updateMutex);
if(cl->useCopyRect) {
sraRegionPtr modifiedRegionBackup;
- if(!sraRgnEmpty(cl->copyRegion) && (cl->copyDX!=dx || cl->copyDY!=dy)) {
- sraRgnOr(cl->copyRegion,cl->modifiedRegion);
- sraRgnMakeEmpty(cl->copyRegion);
+ if(!sraRgnEmpty(cl->copyRegion)) {
+ if(cl->copyDX!=dx || cl->copyDY!=dy) {
+ /* if a copyRegion was not yet executed, treat it as a
+ * modifiedRegion. The idea: in this case it could be
+ * source of the new copyRect or modified anyway. */
+ sraRgnOr(cl->modifiedRegion,cl->copyRegion);
+ sraRgnMakeEmpty(cl->copyRegion);
+ } else {
+ /* we have to set the intersection of the source of the copy
+ * and the old copy to modified. */
+ modifiedRegionBackup=sraRgnCreateRgn(copyRegion);
+ sraRgnOffset(modifiedRegionBackup,-dx,-dy);
+ sraRgnAnd(modifiedRegionBackup,cl->copyRegion);
+ sraRgnOr(cl->modifiedRegion,modifiedRegionBackup);
+ sraRgnDestroy(modifiedRegionBackup);
+ }
}
+
sraRgnOr(cl->copyRegion,copyRegion);
cl->copyDX = dx;
cl->copyDY = dy;
- /* if there were modified regions, which are now copied: */
+ /* if there were modified regions, which are now copied,
+ * mark them as modified, because the source of these can be overlapped
+ * either by new modified or now copied regions. */
modifiedRegionBackup=sraRgnCreateRgn(cl->modifiedRegion);
sraRgnOffset(modifiedRegionBackup,dx,dy);
sraRgnAnd(modifiedRegionBackup,cl->copyRegion);
sraRgnOr(cl->modifiedRegion,modifiedRegionBackup);
sraRgnDestroy(modifiedRegionBackup);
+#if 0
+//TODO: is this needed? Or does it mess up deferring?
/* while(!sraRgnEmpty(cl->copyRegion)) */ {
#ifdef HAVE_PTHREADS
if(!cl->screen->backgroundLoop)
@@ -104,6 +122,7 @@ void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,in
continue;
}
}
+#endif
} else {
sraRgnOr(cl->modifiedRegion,copyRegion);
}