MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / initBuf

Function initBuf

util/pftest.c:36–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34
35
36static void initBuf(unsigned char *buf, int width, int pitch, int height,
37 PF *srcpf, PF *dstpf)
38{
39 int i, j, maxRGB = min(1 << srcpf->bpc, 1 << dstpf->bpc);
40
41 for(j = 0; j < height; j++)
42 {
43 for(i = 0; i < width; i++)
44 {
45 int r, g, b;
46 memset(&buf[j * pitch + i * srcpf->size], 0, srcpf->size);
47 r = (i * maxRGB / width) % maxRGB; g = (j * maxRGB / height) % maxRGB;
48 b = (j * maxRGB / height + i * maxRGB / width) % maxRGB;
49 if(srcpf->bpc == 10 && dstpf->bpc == 8)
50 {
51 r <<= 2; g <<= 2; b <<= 2;
52 }
53 srcpf->setRGB(&buf[j * pitch + i * srcpf->size], r, g, b);
54 }
55 }
56}
57
58
59static int cmpBuf(unsigned char *buf, int width, int pitch, int height,

Callers 1

doTestFunction · 0.70

Calls 1

minFunction · 0.50

Tested by

no test coverage detected