Special handling of a rectangular video area in the UpdateTracker and derived/related classes.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2327 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rfb/UpdateTracker.h b/common/rfb/UpdateTracker.h
index 8e96d55..b6a7d74 100644
--- a/common/rfb/UpdateTracker.h
+++ b/common/rfb/UpdateTracker.h
@@ -30,14 +30,15 @@
     Region changed;
     Region copied;
     Point copy_delta;
+    Rect video_area;
     bool is_empty() const {
-      return copied.is_empty() && changed.is_empty();
+      return copied.is_empty() && changed.is_empty() && video_area.is_empty();
     }
     // NOTE: We do not ever use UpdateInfo::numRects(), because Tight encoding
     //       complicates computing the number of rectangles.
     /*
     int numRects() const {
-      return copied.numRects() + changed.numRects();
+      return copied.numRects() + changed.numRects() + !video_area.is_empty();
     }
     */
   };
@@ -49,6 +50,7 @@
 
     virtual void add_changed(const Region &region) = 0;
     virtual void add_copied(const Region &dest, const Point &delta) = 0;
+    virtual void set_video_area(const Rect &rect) = 0;
   };
 
   class ClippingUpdateTracker : public UpdateTracker {
@@ -61,6 +63,7 @@
 
     virtual void add_changed(const Region &region);
     virtual void add_copied(const Region &dest, const Point &delta);
+    virtual void set_video_area(const Rect &rect);
   protected:
     UpdateTracker* ut;
     Rect clipRect;
@@ -75,6 +78,7 @@
 
     virtual void add_changed(const Region &region);
     virtual void add_copied(const Region &dest, const Point &delta);
+    virtual void set_video_area(const Rect &rect);
     virtual void subtract(const Region& region);
 
     // Fill the supplied UpdateInfo structure with update information
@@ -85,16 +89,33 @@
     virtual void copyTo(UpdateTracker* to) const;
 
     // Move the entire update region by an offset
-    void translate(const Point& p) {changed.translate(p); copied.translate(p);}
+    void translate(const Point& p) {
+      changed.translate(p);
+      copied.translate(p);
+      video_area.translate(p);
+    }
 
-    virtual bool is_empty() const {return changed.is_empty() && copied.is_empty();}
+    virtual bool is_empty() const {
+      return changed.is_empty() && copied.is_empty() && video_area.is_empty();
+    }
 
-    virtual void clear() {changed.clear(); copied.clear();};
+    // NOTE: We do not clear video_area intentionally.
+    virtual void clear() {
+      changed.clear();
+      copied.clear();
+    }
+
   protected:
     Region changed;
     Region copied;
     Point copy_delta;
     bool copy_enabled;
+
+    // We can track one rectangle on the screen as a "video area". We assume
+    // it is changing continuously, in whole. Thus, we don't need to detect
+    // and track individual changes in the video area -- we can assume it's
+    // always in the changed state.
+    Rect video_area;
   };
 
 }