aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb
diff options
context:
space:
mode:
authorConstantin Kaplinsky <const@tightvnc.com>2007-10-10 10:03:06 +0000
committerConstantin Kaplinsky <const@tightvnc.com>2007-10-10 10:03:06 +0000
commitc257370bef6c70176eef01e47edc3e59080fcef4 (patch)
treef6d90cf426e09061bfb0085a0d1f5f52644077c8 /common/rfb
parent9964c782b6e45b2112da8072c66f0aa2ee1243dd (diff)
downloadtigervnc-c257370bef6c70176eef01e47edc3e59080fcef4.tar.gz
tigervnc-c257370bef6c70176eef01e47edc3e59080fcef4.zip
Changes in mapping of JPEG quality levels. Minor code cleanups.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2360 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common/rfb')
-rw-r--r--common/rfb/IrixDMJpegCompressor.cxx9
-rw-r--r--common/rfb/JpegCompressor.cxx6
-rw-r--r--common/rfb/JpegEncoder.cxx9
3 files changed, 14 insertions, 10 deletions
diff --git a/common/rfb/IrixDMJpegCompressor.cxx b/common/rfb/IrixDMJpegCompressor.cxx
index dda059f8..6e155ec1 100644
--- a/common/rfb/IrixDMJpegCompressor.cxx
+++ b/common/rfb/IrixDMJpegCompressor.cxx
@@ -35,7 +35,7 @@ IrixDMJpegCompressor::~IrixDMJpegCompressor()
}
//
-// Set JPEG quality level (0..100)
+// Set JPEG quality level (1..100)
//
// FIXME: Call m_ic.setImageQuality() when necessary.
//
@@ -43,10 +43,11 @@ IrixDMJpegCompressor::~IrixDMJpegCompressor()
void
IrixDMJpegCompressor::setQuality(int level)
{
- if (level < 0)
- level = 0;
- if (level > 100)
+ if (level < 1) {
+ level = 1;
+ } else if (level > 100) {
level = 100;
+ }
m_quality = level;
}
diff --git a/common/rfb/JpegCompressor.cxx b/common/rfb/JpegCompressor.cxx
index 0914f850..0de87b4c 100644
--- a/common/rfb/JpegCompressor.cxx
+++ b/common/rfb/JpegCompressor.cxx
@@ -134,11 +134,11 @@ StandardJpegCompressor::termDestination()
void
StandardJpegCompressor::setQuality(int level)
{
- if (level < 0)
+ if (level < 0) {
level = 0;
- if (level > 100)
+ } else if (level > 100) {
level = 100;
-
+ }
jpeg_set_quality(&m_cinfo, level, true);
}
diff --git a/common/rfb/JpegEncoder.cxx b/common/rfb/JpegEncoder.cxx
index 51d48f16..6903c2cc 100644
--- a/common/rfb/JpegEncoder.cxx
+++ b/common/rfb/JpegEncoder.cxx
@@ -35,7 +35,7 @@ BoolParameter JpegEncoder::useHardwareJPEG
true);
const int JpegEncoder::qualityMap[10] = {
- 5, 10, 15, 25, 37, 50, 60, 70, 75, 80
+ 2, 10, 15, 25, 37, 50, 60, 70, 80, 90
};
JpegEncoder::JpegEncoder(SMsgWriter* writer_) : writer(writer_), jcomp(0)
@@ -71,9 +71,12 @@ JpegEncoder::~JpegEncoder()
void JpegEncoder::setQualityLevel(int level)
{
- if (level >= 0 && level <= 9) {
- jcomp->setQuality(qualityMap[level]);
+ if (level < 0) {
+ level = 0;
+ } else if (level > 9) {
+ level = 9;
}
+ jcomp->setQuality(qualityMap[level]);
}
bool JpegEncoder::writeRect(PixelBuffer* pb, const Rect& r)