diff options
Diffstat (limited to 'libvncserver/zrleencodetemplate.c')
-rw-r--r-- | libvncserver/zrleencodetemplate.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libvncserver/zrleencodetemplate.c b/libvncserver/zrleencodetemplate.c index 6e81b3c..3a6f117 100644 --- a/libvncserver/zrleencodetemplate.c +++ b/libvncserver/zrleencodetemplate.c @@ -89,7 +89,7 @@ static zrlePaletteHelper paletteHelper; #endif /* ZRLE_ONCE */ void ZRLE_ENCODE_TILE (PIXEL_T* data, int w, int h, zrleOutStream* os, - int zywrle_level, int *zywrleBuf); + int zywrle_level, int *zywrleBuf, void *paletteHelper); #if BPP!=8 #define ZYWRLE_ENCODE @@ -111,8 +111,12 @@ static void ZRLE_ENCODE (int x, int y, int w, int h, GET_IMAGE_INTO_BUF(tx,ty,tw,th,buf); + if (cl->paletteHelper == NULL) { + cl->paletteHelper = (void *) calloc(sizeof(zrlePaletteHelper), 1); + } + ZRLE_ENCODE_TILE((PIXEL_T*)buf, tw, th, os, - cl->zywrleLevel, cl->zywrleBuf); + cl->zywrleLevel, cl->zywrleBuf, cl->paletteHelper); } } zrleOutStreamFlush(os); @@ -120,7 +124,7 @@ static void ZRLE_ENCODE (int x, int y, int w, int h, void ZRLE_ENCODE_TILE(PIXEL_T* data, int w, int h, zrleOutStream* os, - int zywrle_level, int *zywrleBuf) + int zywrle_level, int *zywrleBuf, void *paletteHelper) { /* First find the palette and the number of runs */ @@ -140,7 +144,11 @@ void ZRLE_ENCODE_TILE(PIXEL_T* data, int w, int h, zrleOutStream* os, PIXEL_T* end = ptr + h * w; *end = ~*(end-1); /* one past the end is different so the while loop ends */ +#if 0 ph = &paletteHelper; +#else + ph = (zrlePaletteHelper *) paletteHelper; +#endif zrlePaletteHelperInit(ph); while (ptr < end) { @@ -289,7 +297,7 @@ void ZRLE_ENCODE_TILE(PIXEL_T* data, int w, int h, zrleOutStream* os, #if BPP!=8 if (zywrle_level > 0 && !(zywrle_level & 0x80)) { ZYWRLE_ANALYZE(data, data, w, h, w, zywrle_level, zywrleBuf); - ZRLE_ENCODE_TILE(data, w, h, os, zywrle_level | 0x80, zywrleBuf); + ZRLE_ENCODE_TILE(data, w, h, os, zywrle_level | 0x80, zywrleBuf, paletteHelper); } else #endif |