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
"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>
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
#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
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
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
//
// 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>
#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;
if (tileType & hextileRaw) {
is->readBytes(buf, t.area() * (BPP/8));
- IMAGE_RECT(t, buf);
+ handler->imageRect(t, buf);
continue;
}
}
}
}
- IMAGE_RECT(t, buf);
+ handler->imageRect(t, buf);
}
}
}
//
// 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>
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];
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);
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;
//
// 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>
// 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];
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();
//
// 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>
#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();
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);
}
}
//
// 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
//
// 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>
} else {
pix = is->READ_PIXEL();
}
- FILL_RECT(r, pix);
+ handler->fillRect(r, pix);
return;
}
}
if (directDecode) handler->releaseRawBuffer(r);
- else IMAGE_RECT(r, buf);
+ else handler->imageRect(r, buf);
delete [] netbuf;
//
// 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>
//
// 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>
#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);
if (palSize == 1) {
PIXEL_T pix = palette[0];
- FILL_RECT(t,pix);
+ handler->fillRect(t, pix);
continue;
}
//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);
}
}
//
// 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
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
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);
}