]> source.dussan.org Git - tigervnc.git/commitdiff
Uncommented getNumRects.
authorPeter Åstrand <astrand@cendio.se>
Thu, 10 Feb 2005 15:30:47 +0000 (15:30 +0000)
committerPeter Åstrand <astrand@cendio.se>
Thu, 10 Feb 2005 15:30:47 +0000 (15:30 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@165 3789f03b-4d11-0410-bbf8-ca57d06f2519

rfb/TightEncoder.cxx
rfb/TightEncoder.h

index fe23a971dff3a0dbdabd102a5c909e1af3aaa8c6..fb19885ae524086cb16fdd19cb1dbdef6f909954 100644 (file)
@@ -112,27 +112,27 @@ void TightEncoder::setQualityLevel(int level)
   }
 }
 
-//int TightEncoder::getNumRects(const Rect &r)
-//{
-//  const unsigned int w = r.width();
-//  const unsigned int h = r.height();
-//
-//  // Will this rectangle split into subrects?
-//  bool rectTooBig = w > pconf->maxRectWidth || w * h > pconf->maxRectSize;
-//  if (!rectTooBig)
-//    return 1;
-//
-//  // Compute max sub-rectangle size.
-//  const unsigned int subrectMaxWidth =
-//    (w > pconf->maxRectWidth) ? pconf->maxRectWidth : w;
-//  const unsigned int subrectMaxHeight =
-//    pconf->maxRectSize / subrectMaxWidth;
-//
-//  // Return the number of subrects.
-//  return (((w - 1) / pconf->maxRectWidth + 1) *
-//          ((h - 1) / subrectMaxHeight + 1));
-//}
-//
+int TightEncoder::getNumRects(const Rect &r)
+{
+  const unsigned int w = r.width();
+  const unsigned int h = r.height();
+
+  // Will this rectangle split into subrects?
+  bool rectTooBig = w > pconf->maxRectWidth || w * h > pconf->maxRectSize;
+  if (!rectTooBig)
+    return 1;
+
+  // Compute max sub-rectangle size.
+  const unsigned int subrectMaxWidth =
+    (w > pconf->maxRectWidth) ? pconf->maxRectWidth : w;
+  const unsigned int subrectMaxHeight =
+    pconf->maxRectSize / subrectMaxWidth;
+
+  // Return the number of subrects.
+  return (((w - 1) / pconf->maxRectWidth + 1) *
+          ((h - 1) / subrectMaxHeight + 1));
+}
+
 bool TightEncoder::writeRect(const Rect& r, ImageGetter* ig, Rect* actual)
 {
   // Shortcuts to rectangle coordinates and dimensions.
index 181db72a3417a9a71a0e6c724f587ce4727e1080..b6e71a19c178c8ca1052af1a9d537e485da01ea0 100644 (file)
@@ -55,7 +55,7 @@ namespace rfb {
     static Encoder* create(SMsgWriter* writer);
     virtual void setCompressLevel(int level);
     virtual void setQualityLevel(int level);
-      //    virtual int getNumRects(const Rect &r);
+    virtual int getNumRects(const Rect &r);
     virtual bool writeRect(const Rect& r, ImageGetter* ig, Rect* actual);
     virtual ~TightEncoder();