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

Function initBuf

util/bmptest.c:36–57  ·  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 *pf, int orientation)
38{
39 int i, j;
40
41 for(j = 0; j < height; j++)
42 {
43 int row = orientation == BMPORN_TOPDOWN ? j : height - j - 1;
44 for(i = 0; i < width; i++)
45 {
46 int r, g, b;
47 memset(&buf[row * pitch + i * pf->size], 0, pf->size);
48 r = (i * 256 / width) % 256; g = (j * 256 / height) % 256;
49 b = (j * 256 / height + i * 256 / width) % 256;
50 if(pf->bpc == 10)
51 {
52 r <<= 2; g <<= 2; b <<= 2;
53 }
54 pf->setRGB(&buf[row * pitch + i * pf->size], r, g, b);
55 }
56 }
57}
58
59
60static int cmpBuf(unsigned char *buf, int width, int pitch, int height, PF *pf,

Callers 1

doTestFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected