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

Function cmpBuf

util/fbxtest.cpp:83–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81
82
83int cmpBuf(int x, int y, int width, int pitch, int height, PF *pf,
84 unsigned char *buf, int offset, bool flip = false)
85{
86 int i, j;
87
88 for(j = 0; j < height; j++)
89 {
90 int line = flip ? height - 1 - j : j;
91 for(i = 0; i < width; i++)
92 {
93 bool ignore = false;
94 #ifdef __APPLE__
95 // In XQuartz, X[Shm]GetImage() picks up the little window resize
96 // gadget at the bottom right, so we have to ignore those pixels.
97 if(line >= height - 16 && i >= width - 16) ignore = true;
98 #endif
99 int r, g, b;
100 pf->getRGB(&buf[line * pitch + i * pf->size], &r, &g, &b);
101 if(r != (i + x + offset) % MAXRGB && !ignore)
102 return 0;
103 if(g != (j + y + offset) % MAXRGB && !ignore)
104 return 0;
105 if(b != (j + y + i + x + offset) % MAXRGB && !ignore)
106 return 0;
107 }
108 }
109 return 1;
110}
111
112
113// Makes sure the frame buffer has been cleared prior to a write

Callers 3

nativeWriteFunction · 0.70
nativeReadFunction · 0.70
runMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected