summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2014-10-09 16:47:45 +0200
committerPierre Ossman <ossman@cendio.se>2014-10-09 16:47:45 +0200
commit387bf9b3866989e0bb736ef83e2f4510db4132f6 (patch)
tree8516b84bc7d253c3a5e8e058191c5ffd857d422f /tests
parent9168f618883e91d5475a99b5442219c3ed4283a7 (diff)
downloadtigervnc-387bf9b3866989e0bb736ef83e2f4510db4132f6.tar.gz
tigervnc-387bf9b3866989e0bb736ef83e2f4510db4132f6.zip
Use constants for the test buffer dimensions
Diffstat (limited to 'tests')
-rw-r--r--tests/conv.cxx34
1 files changed, 20 insertions, 14 deletions
diff --git a/tests/conv.cxx b/tests/conv.cxx
index 22c86c4e..b4d1f014 100644
--- a/tests/conv.cxx
+++ b/tests/conv.cxx
@@ -26,6 +26,12 @@ static const rdr::U8 pixelRed = 0xf1;
static const rdr::U8 pixelGreen = 0xc3;
static const rdr::U8 pixelBlue = 0x97;
+static const int fbWidth = 40;
+static const int fbHeight = 30;
+static const int fbArea = fbWidth * fbHeight;
+// Maximum bpp, plus some room for unaligned fudging
+static const int fbMalloc = (fbArea * 4) + 4;
+
typedef bool (*testfn) (const rfb::PixelFormat&, const rfb::PixelFormat&);
struct TestEntry {
@@ -117,27 +123,27 @@ static bool testBuffer(const rfb::PixelFormat &dstpf,
const rfb::PixelFormat &srcpf)
{
int i, unaligned;
- rdr::U8 bufIn[1024 + 1], bufOut[1024 + 1];
+ rdr::U8 bufIn[fbMalloc], bufOut[fbMalloc];
// Once aligned, and once unaligned
for (unaligned = 0;unaligned < 2;unaligned++) {
- for (i = 0;i < 1024/4;i++)
+ for (i = 0;i < fbArea;i++)
makePixel(srcpf, bufIn + unaligned + i*srcpf.bpp/8);
memset(bufOut, 0, sizeof(bufOut));
dstpf.bufferFromBuffer(bufOut + unaligned, srcpf,
- bufIn + unaligned, 1024/4);
+ bufIn + unaligned, fbArea);
- for (i = 0;i < 1024/4;i++) {
+ for (i = 0;i < fbArea;i++) {
if (!verifyPixel(dstpf, srcpf, bufOut + unaligned + i*dstpf.bpp/8))
return false;
}
memset(bufOut, 0, sizeof(bufOut));
dstpf.bufferFromBuffer(bufOut + unaligned, srcpf, bufIn + unaligned,
- 1024/4/10, 10, 1024/4/10, 1024/4/10);
+ fbWidth, fbHeight, fbWidth, fbWidth);
- for (i = 0;i < 1024/4/10*10;i++) {
+ for (i = 0;i < fbArea;i++) {
if (!verifyPixel(dstpf, srcpf, bufOut + unaligned + i*dstpf.bpp/8))
return false;
}
@@ -150,33 +156,33 @@ static bool testRGB(const rfb::PixelFormat &dstpf,
const rfb::PixelFormat &srcpf)
{
int i, unaligned;
- rdr::U8 bufIn[1024 + 1], bufRGB[1024 + 1], bufOut[1024 + 1];
+ rdr::U8 bufIn[fbMalloc], bufRGB[fbMalloc], bufOut[fbMalloc];
// Once aligned, and once unaligned
for (unaligned = 0;unaligned < 2;unaligned++) {
- for (i = 0;i < 1024/4;i++)
+ for (i = 0;i < fbArea;i++)
makePixel(srcpf, bufIn + unaligned + i*srcpf.bpp/8);
memset(bufRGB, 0, sizeof(bufRGB));
- srcpf.rgbFromBuffer(bufRGB + unaligned, bufIn + unaligned, 1024/4);
+ srcpf.rgbFromBuffer(bufRGB + unaligned, bufIn + unaligned, fbArea);
memset(bufOut, 0, sizeof(bufOut));
- dstpf.bufferFromRGB(bufOut + unaligned, bufRGB + unaligned, 1024/4);
+ dstpf.bufferFromRGB(bufOut + unaligned, bufRGB + unaligned, fbArea);
- for (i = 0;i < 1024/4;i++) {
+ for (i = 0;i < fbArea;i++) {
if (!verifyPixel(dstpf, srcpf, bufOut + unaligned + i*dstpf.bpp/8))
return false;
}
memset(bufRGB, 0, sizeof(bufRGB));
srcpf.rgbFromBuffer(bufRGB + unaligned, bufIn + unaligned,
- 1024/4/10, 1024/4/10, 10);
+ fbWidth, fbWidth, fbHeight);
memset(bufOut, 0, sizeof(bufOut));
dstpf.bufferFromRGB(bufOut + unaligned, bufRGB + unaligned,
- 1024/4/10, 1024/4/10, 10);
+ fbWidth, fbWidth, fbHeight);
- for (i = 0;i < 1024/4/10*10;i++) {
+ for (i = 0;i < fbArea;i++) {
if (!verifyPixel(dstpf, srcpf, bufOut + unaligned + i*dstpf.bpp/8))
return false;
}