@@ -21,9 +21,6 @@ | |||
using namespace rfb; | |||
#define EXTRA_ARGS CMsgHandler* handler | |||
#define FILL_RECT(r, p) handler->fillRect(r, p) | |||
#define IMAGE_RECT(r, p) handler->imageRect(r, p) | |||
#define BPP 8 | |||
#include <rfb/hextileDecode.h> | |||
#undef BPP |
@@ -30,8 +30,6 @@ BoolParameter improvedHextile("ImprovedHextile", | |||
"ratios by the cost of using more CPU time", | |||
true); | |||
#define EXTRA_ARGS ImageGetter* ig | |||
#define GET_IMAGE_INTO_BUF(r,buf) ig->getImage(buf, r); | |||
#define BPP 8 | |||
#include <rfb/hextileEncode.h> | |||
#include <rfb/hextileEncodeBetter.h> |
@@ -21,9 +21,6 @@ | |||
using namespace rfb; | |||
#define EXTRA_ARGS CMsgHandler* handler | |||
#define FILL_RECT(r, p) handler->fillRect(r, p) | |||
#define IMAGE_RECT(r, p) handler->imageRect(r, p) | |||
#define BPP 8 | |||
#include <rfb/rreDecode.h> | |||
#undef BPP |
@@ -25,8 +25,6 @@ using namespace rfb; | |||
#define TIGHT_MAX_WIDTH 2048 | |||
#define FILL_RECT(r, p) handler->fillRect(r, p) | |||
#define IMAGE_RECT(r, p) handler->imageRect(r, p) | |||
#define BPP 8 | |||
#include <rfb/tightDecode.h> | |||
#undef BPP |
@@ -41,9 +41,6 @@ static inline rdr::U32 readOpaque24B(rdr::InStream* is) | |||
return r; | |||
} | |||
#define EXTRA_ARGS CMsgHandler* handler | |||
#define FILL_RECT(r, p) handler->fillRect(r, p) | |||
#define IMAGE_RECT(r, p) handler->imageRect(r, p) | |||
#define BPP 8 | |||
#include <rfb/zrleDecode.h> | |||
#undef BPP |
@@ -43,8 +43,6 @@ static inline void writeOpaque24B(rdr::OutStream* os, rdr::U32 u) | |||
os->writeU8(((rdr::U8*)&u)[3]); | |||
} | |||
#define EXTRA_ARGS ImageGetter* ig | |||
#define GET_IMAGE_INTO_BUF(r,buf) ig->getImage(buf, r); | |||
#define BPP 8 | |||
#include <rfb/zrleEncode.h> | |||
#undef BPP |
@@ -18,11 +18,8 @@ | |||
// | |||
// Hextile decoding function. | |||
// | |||
// This file is #included after having set the following macros: | |||
// This file is #included after having set the following macro: | |||
// BPP - 8, 16 or 32 | |||
// EXTRA_ARGS - optional extra arguments | |||
// FILL_RECT - fill a rectangle with a single colour | |||
// IMAGE_RECT - draw a rectangle of pixel data from a buffer | |||
#include <rdr/InStream.h> | |||
#include <rfb/hextileConstants.h> | |||
@@ -40,11 +37,8 @@ namespace rfb { | |||
#define READ_PIXEL CONCAT2E(readOpaque,BPP) | |||
#define HEXTILE_DECODE CONCAT2E(hextileDecode,BPP) | |||
void HEXTILE_DECODE (const Rect& r, rdr::InStream* is, PIXEL_T* buf | |||
#ifdef EXTRA_ARGS | |||
, EXTRA_ARGS | |||
#endif | |||
) | |||
void HEXTILE_DECODE (const Rect& r, rdr::InStream* is, PIXEL_T* buf, | |||
CMsgHandler* handler) | |||
{ | |||
Rect t; | |||
PIXEL_T bg = 0; | |||
@@ -62,7 +56,7 @@ void HEXTILE_DECODE (const Rect& r, rdr::InStream* is, PIXEL_T* buf | |||
if (tileType & hextileRaw) { | |||
is->readBytes(buf, t.area() * (BPP/8)); | |||
IMAGE_RECT(t, buf); | |||
handler->imageRect(t, buf); | |||
continue; | |||
} | |||
@@ -100,7 +94,7 @@ void HEXTILE_DECODE (const Rect& r, rdr::InStream* is, PIXEL_T* buf | |||
} | |||
} | |||
} | |||
IMAGE_RECT(t, buf); | |||
handler->imageRect(t, buf); | |||
} | |||
} | |||
} |
@@ -19,10 +19,8 @@ | |||
// | |||
// Hextile encoding function. | |||
// | |||
// This file is #included after having set the following macros: | |||
// This file is #included after having set the following macro: | |||
// BPP - 8, 16 or 32 | |||
// EXTRA_ARGS - optional extra arguments | |||
// GET_IMAGE_INTO_BUF - gets a rectangle of pixel data into a buffer | |||
#include <rdr/OutStream.h> | |||
#include <rfb/hextileConstants.h> | |||
@@ -46,11 +44,7 @@ int TEST_TILE_TYPE (PIXEL_T* data, int w, int h, PIXEL_T* bg, PIXEL_T* fg); | |||
int HEXTILE_ENCODE_TILE (PIXEL_T* data, int w, int h, int tileType, | |||
rdr::U8* encoded, PIXEL_T bg); | |||
void HEXTILE_ENCODE(const Rect& r, rdr::OutStream* os | |||
#ifdef EXTRA_ARGS | |||
, EXTRA_ARGS | |||
#endif | |||
) | |||
void HEXTILE_ENCODE(const Rect& r, rdr::OutStream* os, TransImageGetter *ig) | |||
{ | |||
Rect t; | |||
PIXEL_T buf[256]; | |||
@@ -67,7 +61,7 @@ void HEXTILE_ENCODE(const Rect& r, rdr::OutStream* os | |||
t.br.x = __rfbmin(r.br.x, t.tl.x + 16); | |||
GET_IMAGE_INTO_BUF(t,buf); | |||
ig->getImage(buf, t); | |||
PIXEL_T bg = 0, fg = 0; | |||
int tileType = TEST_TILE_TYPE(buf, t.width(), t.height(), &bg, &fg); | |||
@@ -96,7 +90,7 @@ void HEXTILE_ENCODE(const Rect& r, rdr::OutStream* os | |||
encoded, bg); | |||
if (encodedLen < 0) { | |||
GET_IMAGE_INTO_BUF(t,buf); | |||
ig->getImage(buf, t); | |||
os->writeU8(hextileRaw); | |||
os->writeBytes(buf, t.width() * t.height() * (BPP/8)); | |||
oldBgValid = oldFgValid = false; |
@@ -19,10 +19,8 @@ | |||
// | |||
// Hextile encoding function. | |||
// | |||
// This file is #included after having set the following macros: | |||
// This file is #included after having set the following macro: | |||
// BPP - 8, 16 or 32 | |||
// EXTRA_ARGS - optional extra arguments | |||
// GET_IMAGE_INTO_BUF - gets a rectangle of pixel data into a buffer | |||
#include <rdr/OutStream.h> | |||
#include <rfb/hextileConstants.h> | |||
@@ -277,11 +275,7 @@ void HEXTILE_TILE::encode(rdr::U8 *dst) const | |||
// Main encoding function. | |||
// | |||
void HEXTILE_ENCODE(const Rect& r, rdr::OutStream* os | |||
#ifdef EXTRA_ARGS | |||
, EXTRA_ARGS | |||
#endif | |||
) | |||
void HEXTILE_ENCODE(const Rect& r, rdr::OutStream* os, TransImageGetter *ig) | |||
{ | |||
Rect t; | |||
PIXEL_T buf[256]; | |||
@@ -300,7 +294,7 @@ void HEXTILE_ENCODE(const Rect& r, rdr::OutStream* os | |||
t.br.x = __rfbmin(r.br.x, t.tl.x + 16); | |||
GET_IMAGE_INTO_BUF(t,buf); | |||
ig->getImage(buf, t); | |||
tile.newTile(buf, t.width(), t.height()); | |||
int tileType = tile.getFlags(); |
@@ -18,10 +18,8 @@ | |||
// | |||
// RRE decoding function. | |||
// | |||
// This file is #included after having set the following macros: | |||
// This file is #included after having set the following macro: | |||
// BPP - 8, 16 or 32 | |||
// EXTRA_ARGS - optional extra arguments | |||
// FILL_RECT - fill a rectangle with a single colour | |||
#include <rdr/InStream.h> | |||
@@ -38,15 +36,11 @@ namespace rfb { | |||
#define READ_PIXEL CONCAT2E(readOpaque,BPP) | |||
#define RRE_DECODE CONCAT2E(rreDecode,BPP) | |||
void RRE_DECODE (const Rect& r, rdr::InStream* is | |||
#ifdef EXTRA_ARGS | |||
, EXTRA_ARGS | |||
#endif | |||
) | |||
void RRE_DECODE (const Rect& r, rdr::InStream* is, CMsgHandler* handler) | |||
{ | |||
int nSubrects = is->readU32(); | |||
PIXEL_T bg = is->READ_PIXEL(); | |||
FILL_RECT(r, bg); | |||
handler->fillRect(r, bg); | |||
for (int i = 0; i < nSubrects; i++) { | |||
PIXEL_T pix = is->READ_PIXEL(); | |||
@@ -54,7 +48,7 @@ void RRE_DECODE (const Rect& r, rdr::InStream* is | |||
int y = is->readU16(); | |||
int w = is->readU16(); | |||
int h = is->readU16(); | |||
FILL_RECT(Rect(r.tl.x+x, r.tl.y+y, r.tl.x+x+w, r.tl.y+y+h), pix); | |||
handler->fillRect(Rect(r.tl.x+x, r.tl.y+y, r.tl.x+x+w, r.tl.y+y+h), pix); | |||
} | |||
} | |||
@@ -18,7 +18,7 @@ | |||
// | |||
// RRE encoding function. | |||
// | |||
// This file is #included after having set the following macros: | |||
// This file is #included after having set the following macro: | |||
// BPP - 8, 16 or 32 | |||
// | |||
// The data argument to RRE_ENCODE contains the pixel data, and it writes the |
@@ -21,11 +21,8 @@ | |||
// | |||
// Tight decoding functions. | |||
// | |||
// This file is #included after having set the following macros: | |||
// This file is #included after having set the following macro: | |||
// BPP - 8, 16 or 32 | |||
// EXTRA_ARGS - optional extra arguments | |||
// FILL_RECT - fill a rectangle with a single color | |||
// IMAGE_RECT - draw a rectangle of pixel data from a buffer | |||
#include <rdr/InStream.h> | |||
#include <rdr/ZlibInStream.h> | |||
@@ -80,7 +77,7 @@ void TIGHT_DECODE (const Rect& r) | |||
} else { | |||
pix = is->READ_PIXEL(); | |||
} | |||
FILL_RECT(r, pix); | |||
handler->fillRect(r, pix); | |||
return; | |||
} | |||
@@ -229,7 +226,7 @@ void TIGHT_DECODE (const Rect& r) | |||
} | |||
if (directDecode) handler->releaseRawBuffer(r); | |||
else IMAGE_RECT(r, buf); | |||
else handler->imageRect(r, buf); | |||
delete [] netbuf; | |||
@@ -21,10 +21,8 @@ | |||
// | |||
// tightEncode.h - Tight encoding function. | |||
// | |||
// This file is #included after having set the following macros: | |||
// This file is #included after having set the following macro: | |||
// BPP - 8, 16 or 32 | |||
// EXTRA_ARGS - optional extra arguments | |||
// GET_IMAGE_INTO_BUF - gets a rectangle of pixel data into a buffer | |||
// | |||
#include <assert.h> |
@@ -19,11 +19,8 @@ | |||
// | |||
// ZRLE decoding function. | |||
// | |||
// This file is #included after having set the following macros: | |||
// This file is #included after having set the following macro: | |||
// BPP - 8, 16 or 32 | |||
// EXTRA_ARGS - optional extra arguments | |||
// FILL_RECT - fill a rectangle with a single colour | |||
// IMAGE_RECT - draw a rectangle of pixel data from a buffer | |||
#include <stdio.h> | |||
#include <rdr/InStream.h> | |||
@@ -50,11 +47,8 @@ namespace rfb { | |||
#endif | |||
void ZRLE_DECODE (const Rect& r, rdr::InStream* is, | |||
rdr::ZlibInStream* zis, PIXEL_T* buf | |||
#ifdef EXTRA_ARGS | |||
, EXTRA_ARGS | |||
#endif | |||
) | |||
rdr::ZlibInStream* zis, PIXEL_T* buf, | |||
CMsgHandler* handler) | |||
{ | |||
int length = is->readU32(); | |||
zis->setUnderlying(is, length); | |||
@@ -79,7 +73,7 @@ void ZRLE_DECODE (const Rect& r, rdr::InStream* is, | |||
if (palSize == 1) { | |||
PIXEL_T pix = palette[0]; | |||
FILL_RECT(t,pix); | |||
handler->fillRect(t, pix); | |||
continue; | |||
} | |||
@@ -179,7 +173,7 @@ void ZRLE_DECODE (const Rect& r, rdr::InStream* is, | |||
//fprintf(stderr,"copying data to screen %dx%d at %d,%d\n", | |||
//t.width(),t.height(),t.tl.x,t.tl.y); | |||
IMAGE_RECT(t,buf); | |||
handler->imageRect(t, buf); | |||
} | |||
} | |||
@@ -19,10 +19,8 @@ | |||
// | |||
// zrleEncode.h - zrle encoding function. | |||
// | |||
// This file is #included after having set the following macros: | |||
// This file is #included after having set the following macro: | |||
// BPP - 8, 16 or 32 | |||
// EXTRA_ARGS - optional extra arguments | |||
// GET_IMAGE_INTO_BUF - gets a rectangle of pixel data into a buffer | |||
// | |||
// Note that the buf argument to ZRLE_ENCODE needs to be at least one pixel | |||
// bigger than the largest tile of pixel data, since the ZRLE encoding | |||
@@ -67,11 +65,8 @@ static const int bitsPerPackedPixel[] = { | |||
void ZRLE_ENCODE_TILE (PIXEL_T* data, int w, int h, rdr::OutStream* os); | |||
void ZRLE_ENCODE (const Rect& r, rdr::OutStream* os, | |||
rdr::ZlibOutStream* zos, void* buf | |||
#ifdef EXTRA_ARGS | |||
, EXTRA_ARGS | |||
#endif | |||
) | |||
rdr::ZlibOutStream* zos, void* buf, | |||
TransImageGetter *ig) | |||
{ | |||
zos->setUnderlying(os); | |||
// RLE overhead is at worst 1 byte per 64x64 (4Kpixel) block | |||
@@ -88,7 +83,7 @@ void ZRLE_ENCODE (const Rect& r, rdr::OutStream* os, | |||
t.br.x = __rfbmin(r.br.x, t.tl.x + 64); | |||
GET_IMAGE_INTO_BUF(t,buf); | |||
ig->getImage(buf, t); | |||
ZRLE_ENCODE_TILE((PIXEL_T*)buf, t.width(), t.height(), zos); | |||
} |