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

Method copyPixels

server/VirtualDrawable.cpp:558–594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

556
557
558void VirtualDrawable::copyPixels(GLint srcX, GLint srcY, GLint width,
559 GLint height, GLint destX, GLint destY, GLXDrawable draw, GLint readBuf,
560 GLint drawBuf)
561{
562 initReadbackContext();
563 TempContext tc(edpy != EGL_NO_DISPLAY ? (Display *)edpy : dpy,
564 draw, getGLXDrawable(), ctx, edpy != EGL_NO_DISPLAY);
565
566 backend::readBuffer(readBuf);
567 backend::drawBuffer(drawBuf);
568
569 _glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
570 _glPixelStorei(GL_PACK_ALIGNMENT, 1);
571
572 TRY_GL();
573
574 _glViewport(0, 0, width, height);
575 _glMatrixMode(GL_PROJECTION);
576 _glPushMatrix();
577 _glLoadIdentity();
578 _glOrtho(0, width, 0, height, -1, 1);
579 _glMatrixMode(GL_MODELVIEW);
580 _glPushMatrix();
581 _glLoadIdentity();
582
583 for(GLint i = 0; i < height; i++)
584 {
585 _glRasterPos2i(destX, height - destY - i - 1);
586 _glCopyPixels(srcX, height - srcY - i - 1, width, 1, GL_COLOR);
587 }
588 CATCH_GL("Could not copy pixels");
589
590 _glMatrixMode(GL_MODELVIEW);
591 _glPopMatrix();
592 _glMatrixMode(GL_PROJECTION);
593 _glPopMatrix();
594}

Callers 1

XCopyAreaFunction · 0.80

Calls 2

readBufferFunction · 0.85
drawBufferFunction · 0.70

Tested by

no test coverage detected