summaryrefslogtreecommitdiffstats
path: root/rfb
diff options
context:
space:
mode:
authorPeter Åstrand <astrand@cendio.se>2004-11-17 09:45:44 +0000
committerPeter Åstrand <astrand@cendio.se>2004-11-17 09:45:44 +0000
commit5bbe348414cbc109eb592d9f6b46109af7a0dbea (patch)
tree640512c02c50447a39b31d6eb17393295ffc45ca /rfb
parentef5dd31c76b9d7ee304c39efca1be326d5c565eb (diff)
downloadtigervnc-5bbe348414cbc109eb592d9f6b46109af7a0dbea.tar.gz
tigervnc-5bbe348414cbc109eb592d9f6b46109af7a0dbea.zip
Using constants defined in TightDecoder.h, instead of hardcoded values
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@16 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'rfb')
-rw-r--r--rfb/TightDecoder.h11
-rw-r--r--rfb/tightDecode.h14
2 files changed, 18 insertions, 7 deletions
diff --git a/rfb/TightDecoder.h b/rfb/TightDecoder.h
index 4403b387..7ca6f625 100644
--- a/rfb/TightDecoder.h
+++ b/rfb/TightDecoder.h
@@ -33,6 +33,17 @@ namespace rfb {
CMsgReader* reader;
rdr::ZlibInStream zis[4];
};
+
+ /* Compression control */
+ const unsigned int rfbTightExplicitFilter = 0x04;
+ const unsigned int rfbTightFill = 0x08;
+ const unsigned int rfbTightJpeg = 0x09;
+ const unsigned int rfbTightMaxSubencoding = 0x09;
+
+ /* Filters to improve compression efficiency */
+ const unsigned int rfbTightFilterCopy = 0x00;
+ const unsigned int rfbTightFilterPalette = 0x01;
+ const unsigned int rfbTightFilterGradient = 0x02;
}
#endif
diff --git a/rfb/tightDecode.h b/rfb/tightDecode.h
index 004f641f..d3d9609a 100644
--- a/rfb/tightDecode.h
+++ b/rfb/tightDecode.h
@@ -65,20 +65,20 @@ void TIGHT_DECODE (const Rect& r, rdr::InStream* is,
}
// "Fill" compression type.
- if (comp_ctl == 0x08) {
+ if (comp_ctl == rfbTightFill) {
PIXEL_T pix = is->READ_PIXEL();
FILL_RECT(r, pix);
return;
}
// "JPEG" compression type.
- if (comp_ctl == 0x09) {
+ if (comp_ctl == rfbTightJpeg) {
throw Exception("TightDecoder: FIXME: JPEG compression is not supported yet");
return;
}
// Quit on unsupported compression type.
- if (comp_ctl > 0x09) {
+ if (comp_ctl > rfbTightMaxSubencoding) {
throw Exception("TightDecoder: bad subencoding value received");
return;
}
@@ -88,21 +88,21 @@ void TIGHT_DECODE (const Rect& r, rdr::InStream* is,
PIXEL_T palette[256];
bool useGradient = false;
- if ((comp_ctl & 0x04) != 0) {
+ if ((comp_ctl & rfbTightExplicitFilter) != 0) {
rdr::U8 filterId = is->readU8();
switch (filterId) {
- case 0x01: // "palette" filter
+ case rfbTightFilterPalette:
palSize = is->readU8() + 1;
{
for (int i = 0; i < palSize; i++)
palette[i] = is->READ_PIXEL();
}
break;
- case 0x02: // "gradient" filter
+ case rfbTightFilterGradient:
useGradient = true;
break;
- case 0x00: // no filter
+ case rfbTightFilterCopy:
break;
default:
throw Exception("TightDecoder: unknown filter code received");