Consolidate the different palette handler implementations
diff --git a/common/rfb/TightEncoder.h b/common/rfb/TightEncoder.h
index e2fa96e..a876b6f 100644
--- a/common/rfb/TightEncoder.h
+++ b/common/rfb/TightEncoder.h
@@ -23,6 +23,7 @@
#include <rdr/ZlibOutStream.h>
#include <rfb/Encoder.h>
#include <rfb/JpegCompressor.h>
+#include <rfb/Palette.h>
// FIXME: Check if specifying extern "C" is really necessary.
#include <stdio.h>
@@ -45,28 +46,6 @@
};
//
- // C-style structures to store palette entries and compression paramentes.
- // Such code probably should be converted into C++ classes.
- //
-
- struct TIGHT_COLOR_LIST {
- TIGHT_COLOR_LIST *next;
- int idx;
- rdr::U32 rgb;
- };
-
- struct TIGHT_PALETTE_ENTRY {
- TIGHT_COLOR_LIST *listNode;
- int numPixels;
- };
-
- struct TIGHT_PALETTE {
- TIGHT_PALETTE_ENTRY entry[256];
- TIGHT_COLOR_LIST *hash[256];
- TIGHT_COLOR_LIST list[256];
- };
-
- //
// Compression level stuff. The following array contains various
// encoder parameters for each of 10 compression levels (0..9).
// Last three parameters correspond to JPEG quality levels (0..9).
@@ -99,9 +78,6 @@
rdr::ZlibOutStream *zos, int zlibLevel,
rdr::OutStream *os);
- int paletteInsert(rdr::U32 rgb, int numPixels, int bpp);
- void paletteReset(void);
-
void fastFillPalette8(const rdr::U8 *data, int stride, const Rect &r);
void fastFillPalette16(const rdr::U16 *data, int stride, const Rect &r);
void fastFillPalette32(const rdr::U32 *data, int stride, const Rect &r);
@@ -149,9 +125,8 @@
PixelFormat serverpf, clientpf;
bool pack24;
- int palMaxColors, palNumColors;
- rdr::U32 monoBackground, monoForeground;
- TIGHT_PALETTE palette;
+ int palMaxColors;
+ Palette palette;
static const int defaultCompressLevel;
static const TIGHT_CONF conf[];