From cf1d7f11b444452c3692d2ca0cb320d54460c7b7 Mon Sep 17 00:00:00 2001 From: Constantin Kaplinsky Date: Fri, 7 Dec 2007 08:23:04 +0000 Subject: [PATCH] Various improvements in the IrixDMJpegCompressor class. Member functions have been declared virtual. The setQuality() function allows compression levels in the range [1..99] now, and calls IrixDMIC_RawToJpeg::setImageQuality() when necessary. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2372 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- common/rfb/IrixDMJpegCompressor.cxx | 14 +++++++------- common/rfb/IrixDMJpegCompressor.h | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/common/rfb/IrixDMJpegCompressor.cxx b/common/rfb/IrixDMJpegCompressor.cxx index 6e155ec1..33397f63 100644 --- a/common/rfb/IrixDMJpegCompressor.cxx +++ b/common/rfb/IrixDMJpegCompressor.cxx @@ -35,9 +35,7 @@ IrixDMJpegCompressor::~IrixDMJpegCompressor() } // -// Set JPEG quality level (1..100) -// -// FIXME: Call m_ic.setImageQuality() when necessary. +// Set JPEG quality level (1..99) // void @@ -45,11 +43,13 @@ IrixDMJpegCompressor::setQuality(int level) { if (level < 1) { level = 1; - } else if (level > 100) { - level = 100; + } else if (level > 99) { + level = 99; + } + if (level != m_quality) { + m_quality = level; + m_ic.setImageQuality(level); } - - m_quality = level; } // diff --git a/common/rfb/IrixDMJpegCompressor.h b/common/rfb/IrixDMJpegCompressor.h index 500884af..db242003 100644 --- a/common/rfb/IrixDMJpegCompressor.h +++ b/common/rfb/IrixDMJpegCompressor.h @@ -26,15 +26,15 @@ namespace rfb { bool isValid() const { return m_ic.isValid(); } // Set JPEG quality level (0..100). - void setQuality(int level); + virtual void setQuality(int level); // Actually compress the image. - void compress(const rdr::U32 *buf, const PixelFormat *fmt, - int w, int h, int stride); + virtual void compress(const rdr::U32 *buf, const PixelFormat *fmt, + int w, int h, int stride); // Access results of the compression. - size_t getDataLength() { return m_compressedLength; } - const char *getDataPtr() { return m_compressedData; } + virtual size_t getDataLength() { return m_compressedLength; } + virtual const char *getDataPtr() { return m_compressedData; } protected: // Update image size and make sure that our buffer pools will -- 2.39.5