Jpeg decompressor now supports 24/32 bpp.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@42 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfb/tightDecode.h b/rfb/tightDecode.h
index ac8b0a0..d916761 100644
--- a/rfb/tightDecode.h
+++ b/rfb/tightDecode.h
@@ -213,8 +213,9 @@
 {
   struct jpeg_decompress_struct cinfo;
   struct jpeg_error_mgr jerr;
-  PIXEL_T *pixelPtr;
-  JSAMPROW scanline;
+  PIXEL_T *pixelPtr = buf;
+  static rdr::U8 scanline_buffer[TIGHT_MAX_WIDTH*3];
+  JSAMPROW scanline = scanline_buffer;
 
   // Read length
   int compressedLen = is->readCompactLength();
@@ -244,21 +245,17 @@
   }
 
   // Decompress
-  scanline = (JSAMPROW)buf;
   const rfb::PixelFormat& myFormat = handler->cp.pf();
-  int bytesPerRow = cinfo.output_width * myFormat.bpp/8;
   while (cinfo.output_scanline < cinfo.output_height) {
     jpeg_read_scanlines(&cinfo, &scanline, 1);
     if (jpegError) {
       break;
     }
 
-    pixelPtr = (PIXEL_T*)(scanline);
     for (int dx = 0; dx < r.width(); dx++) {
       *pixelPtr++ = 
 	RGB24_TO_PIXEL(scanline[dx*3], scanline[dx*3+1], scanline[dx*3+2]);
     }
-    scanline += bytesPerRow;
   }
 
   IMAGE_RECT(r, buf);