diff options
author | Peter Åstrand <astrand@cendio.se> | 2004-12-13 08:53:49 +0000 |
---|---|---|
committer | Peter Åstrand <astrand@cendio.se> | 2004-12-13 08:53:49 +0000 |
commit | 6b911664d3cca94b931868d569eb1ee614e2218d (patch) | |
tree | debe9bcaf02d90483141d7143072802f7a6adb36 | |
parent | bf27e3accae0562a79467a7aecfff929aee0b15a (diff) | |
download | tigervnc-6b911664d3cca94b931868d569eb1ee614e2218d.tar.gz tigervnc-6b911664d3cca94b931868d569eb1ee614e2218d.zip |
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
-rw-r--r-- | rfb/tightDecode.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/rfb/tightDecode.h b/rfb/tightDecode.h index ac8b0a04..d9167610 100644 --- a/rfb/tightDecode.h +++ b/rfb/tightDecode.h @@ -213,8 +213,9 @@ DecompressJpegRect(const Rect& r, rdr::InStream* is, { 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 @@ DecompressJpegRect(const Rect& r, rdr::InStream* is, } // 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); |