Get rid of unnecessary macros as they are only ever set to a single thing
diff --git a/common/rfb/HextileDecoder.cxx b/common/rfb/HextileDecoder.cxx
index 04ef956..dbf75c9 100644
--- a/common/rfb/HextileDecoder.cxx
+++ b/common/rfb/HextileDecoder.cxx
@@ -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
diff --git a/common/rfb/HextileEncoder.cxx b/common/rfb/HextileEncoder.cxx
index c31e608..69b522f 100644
--- a/common/rfb/HextileEncoder.cxx
+++ b/common/rfb/HextileEncoder.cxx
@@ -30,8 +30,6 @@
"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>
diff --git a/common/rfb/RREDecoder.cxx b/common/rfb/RREDecoder.cxx
index 97d7a71..b780842 100644
--- a/common/rfb/RREDecoder.cxx
+++ b/common/rfb/RREDecoder.cxx
@@ -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
diff --git a/common/rfb/TightDecoder.cxx b/common/rfb/TightDecoder.cxx
index 635df55..a317d25 100644
--- a/common/rfb/TightDecoder.cxx
+++ b/common/rfb/TightDecoder.cxx
@@ -25,8 +25,6 @@
#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
diff --git a/common/rfb/ZRLEDecoder.cxx b/common/rfb/ZRLEDecoder.cxx
index ffc24e3..d4d3444 100644
--- a/common/rfb/ZRLEDecoder.cxx
+++ b/common/rfb/ZRLEDecoder.cxx
@@ -41,9 +41,6 @@
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
diff --git a/common/rfb/ZRLEEncoder.cxx b/common/rfb/ZRLEEncoder.cxx
index 840af6b..5a65703 100644
--- a/common/rfb/ZRLEEncoder.cxx
+++ b/common/rfb/ZRLEEncoder.cxx
@@ -43,8 +43,6 @@
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
diff --git a/common/rfb/hextileDecode.h b/common/rfb/hextileDecode.h
index 7aa04d9..518a606 100644
--- a/common/rfb/hextileDecode.h
+++ b/common/rfb/hextileDecode.h
@@ -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 @@
#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 @@
if (tileType & hextileRaw) {
is->readBytes(buf, t.area() * (BPP/8));
- IMAGE_RECT(t, buf);
+ handler->imageRect(t, buf);
continue;
}
@@ -100,7 +94,7 @@
}
}
}
- IMAGE_RECT(t, buf);
+ handler->imageRect(t, buf);
}
}
}
diff --git a/common/rfb/hextileEncode.h b/common/rfb/hextileEncode.h
index 0d2e8ab..7e5b2db 100644
--- a/common/rfb/hextileEncode.h
+++ b/common/rfb/hextileEncode.h
@@ -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 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 @@
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 @@
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;
diff --git a/common/rfb/hextileEncodeBetter.h b/common/rfb/hextileEncodeBetter.h
index e1730ba..3a96ab6 100644
--- a/common/rfb/hextileEncodeBetter.h
+++ b/common/rfb/hextileEncodeBetter.h
@@ -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 @@
// 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 @@
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();
diff --git a/common/rfb/rreDecode.h b/common/rfb/rreDecode.h
index 1f5bdf8..d37461f 100644
--- a/common/rfb/rreDecode.h
+++ b/common/rfb/rreDecode.h
@@ -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 @@
#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 @@
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);
}
}
diff --git a/common/rfb/rreEncode.h b/common/rfb/rreEncode.h
index 3f83487..e371057 100644
--- a/common/rfb/rreEncode.h
+++ b/common/rfb/rreEncode.h
@@ -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
diff --git a/common/rfb/tightDecode.h b/common/rfb/tightDecode.h
index e139943..620fb79 100644
--- a/common/rfb/tightDecode.h
+++ b/common/rfb/tightDecode.h
@@ -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 @@
} else {
pix = is->READ_PIXEL();
}
- FILL_RECT(r, pix);
+ handler->fillRect(r, pix);
return;
}
@@ -229,7 +226,7 @@
}
if (directDecode) handler->releaseRawBuffer(r);
- else IMAGE_RECT(r, buf);
+ else handler->imageRect(r, buf);
delete [] netbuf;
diff --git a/common/rfb/tightEncode.h b/common/rfb/tightEncode.h
index 1fd0f53..caa63f7 100644
--- a/common/rfb/tightEncode.h
+++ b/common/rfb/tightEncode.h
@@ -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>
diff --git a/common/rfb/zrleDecode.h b/common/rfb/zrleDecode.h
index 207a6c7..4bcbf1f 100644
--- a/common/rfb/zrleDecode.h
+++ b/common/rfb/zrleDecode.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 @@
#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 @@
if (palSize == 1) {
PIXEL_T pix = palette[0];
- FILL_RECT(t,pix);
+ handler->fillRect(t, pix);
continue;
}
@@ -179,7 +173,7 @@
//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);
}
}
diff --git a/common/rfb/zrleEncode.h b/common/rfb/zrleEncode.h
index cfc2a46..8767d54 100644
--- a/common/rfb/zrleEncode.h
+++ b/common/rfb/zrleEncode.h
@@ -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 @@
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 @@
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);
}