]> source.dussan.org Git - tigervnc.git/commitdiff
Oops. BPP is always 8 in the body of compressData(). We want pf.bpp instead.
authorDRC <dcommander@users.sourceforge.net>
Tue, 9 Aug 2011 18:20:55 +0000 (18:20 +0000)
committerDRC <dcommander@users.sourceforge.net>
Tue, 9 Aug 2011 18:20:55 +0000 (18:20 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/branches/1_1@4621 3789f03b-4d11-0410-bbf8-ca57d06f2519

common/rfb/tightEncode.h

index 1a0ea82d00ed3d2800cbbdd4c8c12241de333148..28d6dc2b427f78fa04dca7fb7f6fc530be2b789c 100644 (file)
@@ -182,14 +182,15 @@ static int paletteInsert(rdr::U32 rgb, int numPixels, int bpp)
 //
 
 static void compressData(rdr::OutStream *os, rdr::ZlibOutStream *zos,
-                         const void *buf, unsigned int length, int zlibLevel)
+                         const void *buf, const PixelFormat& pf,
+                         unsigned int length, int zlibLevel)
 {
   if (length < TIGHT_MIN_TO_COMPRESS) {
     os->writeBytes(buf, length);
   } else {
     // FIXME: Using a temporary MemOutStream may be not efficient.
     //        Maybe use the same static object used in the JPEG coder?
-    int maxBeforeSize = s_pconf->maxRectSize * (BPP / 8);
+    int maxBeforeSize = s_pconf->maxRectSize * (pf.bpp / 8);
     int maxAfterSize = maxBeforeSize + (maxBeforeSize + 99) / 100 + 12;
     rdr::MemOutStream mem_os(maxAfterSize);
     zos->setUnderlying(&mem_os);
@@ -394,7 +395,7 @@ static void ENCODE_FULLCOLOR_RECT (rdr::OutStream *os, rdr::ZlibOutStream zos[4]
   os->writeU8(streamId << 4);
 
   int length = PACK_PIXELS(buf, r.area(), pf);
-  compressData(os, &zos[streamId], buf, length, s_pconf->rawZlibLevel);
+  compressData(os, &zos[streamId], buf, pf, length, s_pconf->rawZlibLevel);
 }
 
 static void ENCODE_MONO_RECT (rdr::OutStream *os, rdr::ZlibOutStream zos[4],
@@ -460,7 +461,7 @@ static void ENCODE_MONO_RECT (rdr::OutStream *os, rdr::ZlibOutStream zos[4],
   // Write the data
   int length = (w + 7) / 8;
   length *= h;
-  compressData(os, &zos[streamId], buf, length, s_pconf->monoZlibLevel);
+  compressData(os, &zos[streamId], buf, pf, length, s_pconf->monoZlibLevel);
 }
 
 #if (BPP != 8)
@@ -508,7 +509,7 @@ static void ENCODE_INDEXED_RECT (rdr::OutStream *os, rdr::ZlibOutStream zos[4],
   }
 
   // Write the data
-  compressData(os, &zos[streamId], buf, r.area(), s_pconf->idxZlibLevel);
+  compressData(os, &zos[streamId], buf, pf, r.area(), s_pconf->idxZlibLevel);
 }
 #endif  // #if (BPP != 8)