From 311a2b47cb39567953dad8170b63f3bb4eb7639e Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 30 Jan 2012 13:58:44 +0000 Subject: The Tight encoder uses the pixel buffer as a scratch pad, which doesn't work so well with the new optimisation to feed it the raw frame buffer. Reorganise and clean up the code to handle this, and make the raw frame buffer pointer const so that we might avoid such bugs in the future. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4841 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- common/rfb/TightEncoder.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'common/rfb/TightEncoder.cxx') diff --git a/common/rfb/TightEncoder.cxx b/common/rfb/TightEncoder.cxx index 9be4581e..fcd9d9b0 100644 --- a/common/rfb/TightEncoder.cxx +++ b/common/rfb/TightEncoder.cxx @@ -418,3 +418,19 @@ void TightEncoder::writeSubrect(const Rect& r, bool forceSolid) os->writeBytes(mos.data(), mos.length()); writer->endRect(); } + +void TightEncoder::encodeJpegRect(const Rect& r, rdr::OutStream *os) +{ + const rdr::U8 *buf; + int stride; + + buf = ig->getRawPixelsR(r, &stride); + + jc.clear(); + jc.compress(buf, stride * serverpf.bpp / 8, r, serverpf, + jpegQuality, jpegSubsampling); + + os->writeU8(0x09 << 4); + os->writeCompactLength(jc.length()); + os->writeBytes(jc.data(), jc.length()); +} -- cgit v1.2.3