diff options
author | Pierre Ossman <ossman@cendio.se> | 2014-02-12 13:16:43 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2014-07-07 14:42:08 +0200 |
commit | bcc295e5a60954ff39b011d6a2cbdf052a0efafc (patch) | |
tree | 592c120c797609fc84e359d7286b6b8a66b40c8b | |
parent | 7b5c069d2e7eaa1748507a03697c14900258e507 (diff) | |
download | tigervnc-bcc295e5a60954ff39b011d6a2cbdf052a0efafc.tar.gz tigervnc-bcc295e5a60954ff39b011d6a2cbdf052a0efafc.zip |
Get rid of unnecessary macros as they are only ever set to a single thing
-rw-r--r-- | common/rfb/HextileDecoder.cxx | 3 | ||||
-rw-r--r-- | common/rfb/HextileEncoder.cxx | 2 | ||||
-rw-r--r-- | common/rfb/RREDecoder.cxx | 3 | ||||
-rw-r--r-- | common/rfb/TightDecoder.cxx | 2 | ||||
-rw-r--r-- | common/rfb/ZRLEDecoder.cxx | 3 | ||||
-rw-r--r-- | common/rfb/ZRLEEncoder.cxx | 2 | ||||
-rw-r--r-- | common/rfb/hextileDecode.h | 16 | ||||
-rw-r--r-- | common/rfb/hextileEncode.h | 14 | ||||
-rw-r--r-- | common/rfb/hextileEncodeBetter.h | 12 | ||||
-rw-r--r-- | common/rfb/rreDecode.h | 14 | ||||
-rw-r--r-- | common/rfb/rreEncode.h | 2 | ||||
-rw-r--r-- | common/rfb/tightDecode.h | 9 | ||||
-rw-r--r-- | common/rfb/tightEncode.h | 4 | ||||
-rw-r--r-- | common/rfb/zrleDecode.h | 16 | ||||
-rw-r--r-- | common/rfb/zrleEncode.h | 13 |
15 files changed, 30 insertions, 85 deletions
diff --git a/common/rfb/HextileDecoder.cxx b/common/rfb/HextileDecoder.cxx index 04ef956b..dbf75c94 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 c31e608c..69b522f8 100644 --- a/common/rfb/HextileEncoder.cxx +++ b/common/rfb/HextileEncoder.cxx @@ -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> diff --git a/common/rfb/RREDecoder.cxx b/common/rfb/RREDecoder.cxx index 97d7a71d..b7808421 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 635df551..a317d250 100644 --- a/common/rfb/TightDecoder.cxx +++ b/common/rfb/TightDecoder.cxx @@ -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 diff --git a/common/rfb/ZRLEDecoder.cxx b/common/rfb/ZRLEDecoder.cxx index ffc24e3c..d4d3444d 100644 --- a/common/rfb/ZRLEDecoder.cxx +++ b/common/rfb/ZRLEDecoder.cxx @@ -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 diff --git a/common/rfb/ZRLEEncoder.cxx b/common/rfb/ZRLEEncoder.cxx index 840af6be..5a65703d 100644 --- a/common/rfb/ZRLEEncoder.cxx +++ b/common/rfb/ZRLEEncoder.cxx @@ -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 diff --git a/common/rfb/hextileDecode.h b/common/rfb/hextileDecode.h index 7aa04d91..518a6063 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 @@ 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); } } } diff --git a/common/rfb/hextileEncode.h b/common/rfb/hextileEncode.h index 0d2e8aba..7e5b2db7 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 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; diff --git a/common/rfb/hextileEncodeBetter.h b/common/rfb/hextileEncodeBetter.h index e1730ba5..3a96ab63 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 @@ 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(); diff --git a/common/rfb/rreDecode.h b/common/rfb/rreDecode.h index 1f5bdf8b..d37461f9 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 @@ 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); } } diff --git a/common/rfb/rreEncode.h b/common/rfb/rreEncode.h index 3f834877..e3710575 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 e1399431..620fb798 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 @@ 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; diff --git a/common/rfb/tightEncode.h b/common/rfb/tightEncode.h index 1fd0f530..caa63f76 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 207a6c74..4bcbf1f0 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 @@ 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); } } diff --git a/common/rfb/zrleEncode.h b/common/rfb/zrleEncode.h index cfc2a469..8767d541 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 @@ 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); } |