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 {
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;
}
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;
}