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

Method readPixels

server/VirtualWin.cpp:673–722  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

671
672
673void VirtualWin::readPixels(GLint x, GLint y, GLint width, GLint pitch,
674 GLint height, GLenum glFormat, PF *pf, GLubyte *bits, GLint buf, bool stereo)
675{
676 VirtualDrawable::readPixels(x, y, width, pitch, height, glFormat, pf, bits,
677 buf, stereo);
678
679 // Gamma correction
680 if(fconfig.gamma != 0.0 && fconfig.gamma != 1.0 && fconfig.gamma != -1.0)
681 {
682 profGamma.startFrame();
683 static bool first = true;
684 if(first)
685 {
686 first = false;
687 if(fconfig.verbose)
688 vglout.println("[VGL] Using software gamma correction (correction factor=%f)\n",
689 fconfig.gamma);
690 }
691 if(pf->bpc == 10)
692 {
693 int h = height;
694 while(h--)
695 {
696 int w = width;
697 unsigned int *srcPixel = (unsigned int *)bits;
698 while(w--)
699 {
700 unsigned int r =
701 fconfig.gamma_lut10[(*srcPixel >> pf->rshift) & 1023];
702 unsigned int g =
703 fconfig.gamma_lut10[(*srcPixel >> pf->gshift) & 1023];
704 unsigned int b =
705 fconfig.gamma_lut10[(*srcPixel >> pf->bshift) & 1023];
706 *srcPixel++ =
707 (r << pf->rshift) | (g << pf->gshift) | (b << pf->bshift);
708 }
709 bits += pitch;
710 }
711 }
712 else
713 {
714 unsigned short *ptr1, *ptr2 = (unsigned short *)(&bits[pitch * height]);
715 for(ptr1 = (unsigned short *)bits; ptr1 < ptr2; ptr1++)
716 *ptr1 = fconfig.gamma_lut16[*ptr1];
717 if((pitch * height) % 2 != 0)
718 bits[pitch * height - 1] = fconfig.gamma_lut[bits[pitch * height - 1]];
719 }
720 profGamma.endFrame(width * height, 0, stereo ? 0.5 : 1);
721 }
722}
723
724
725bool VirtualWin::isStereo(void)

Callers

nothing calls this directly

Calls 4

readPixelsFunction · 0.85
startFrameMethod · 0.80
printlnMethod · 0.80
endFrameMethod · 0.80

Tested by

no test coverage detected