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

Function checkFrame

common/frameut.cpp:168–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166 }
167
168 bool checkFrame(Frame *frame)
169 {
170 int i, j, _j, pitch = frame->pitch, seed = frame->hdr.winid;
171 unsigned char *ptr = frame->bits, *pixel;
172 PF *pf = pf_get(frame->hdr.dpynum);
173 int maxRGB = (1 << pf->bpc);
174
175 for(_j = 0; _j < frame->hdr.height; _j++, ptr += pitch)
176 {
177 j = frame->flags & FRAME_BOTTOMUP ? frame->hdr.height - _j - 1 : _j;
178 for(i = 0, pixel = ptr; i < frame->hdr.width;
179 i++, pixel += frame->pf->size)
180 {
181 int r, g, b;
182 frame->pf->getRGB(pixel, &r, &g, &b);
183 if(frame->pf->bpc == 10 && pf->bpc != 10)
184 {
185 r >>= 2; g >>= 2; b >>= 2;
186 }
187 if(addLogo && !useXV)
188 {
189 int lw = min(VGLLOGO_WIDTH, frame->hdr.width - 1);
190 int lh = min(VGLLOGO_HEIGHT, frame->hdr.height - 1);
191 int li = i - (frame->hdr.width - lw - 1);
192 int lj = j - (frame->hdr.height - lh - 1);
193 if(lw > 0 && lh > 0 && li >= 0 && lj >= 0 && li < lw && lj < lh
194 && vgllogo[lj * VGLLOGO_WIDTH + li])
195 {
196 r ^= 113; g ^= 162; b ^= 117;
197 }
198 }
199 if(r != (i + seed) % maxRGB || g != (j + seed) % maxRGB
200 || b != (i + j + seed) % maxRGB)
201 return false;
202 }
203 }
204
205 return true;
206 }
207
208 int findex; bool deadYet;
209 Frame *frames[NFRAMES];

Callers 1

frameut.cppFile · 0.70

Calls 2

pf_getFunction · 0.85
minFunction · 0.50

Tested by

no test coverage detected