示例#1
0
/**
 * Do software-based glCopyPixels.
 * By time we get here, all parameters will have been error-checked.
 */
void
_swrast_CopyPixels( struct gl_context *ctx,
                    GLint srcx, GLint srcy, GLsizei width, GLsizei height,
                    GLint destx, GLint desty, GLenum type )
{
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    struct gl_renderbuffer *rb;

    if (!_mesa_check_conditional_render(ctx))
        return; /* don't copy */

    if (swrast->NewState)
        _swrast_validate_derived( ctx );

    if (!(SWRAST_CONTEXT(ctx)->_RasterMask != 0x0 ||
            ctx->Pixel.ZoomX != 1.0F ||
            ctx->Pixel.ZoomY != 1.0F ||
            ctx->_ImageTransferState) &&
            swrast_fast_copy_pixels(ctx, srcx, srcy, width, height, destx, desty,
                                    type)) {
        /* all done */
        return;
    }

    swrast_render_start(ctx);
    rb = map_readbuffer(ctx, type);

    switch (type) {
    case GL_COLOR:
        copy_rgba_pixels( ctx, srcx, srcy, width, height, destx, desty );
        break;
    case GL_DEPTH:
        copy_depth_pixels( ctx, srcx, srcy, width, height, destx, desty );
        break;
    case GL_STENCIL:
        copy_stencil_pixels( ctx, srcx, srcy, width, height, destx, desty );
        break;
    case GL_DEPTH_STENCIL_EXT:
        /* Copy buffers separately (if the fast copy path wasn't taken) */
        copy_depth_pixels(ctx, srcx, srcy, width, height, destx, desty);
        copy_stencil_pixels(ctx, srcx, srcy, width, height, destx, desty);
        break;
    default:
        _mesa_problem(ctx, "unexpected type in _swrast_CopyPixels");
    }

    swrast_render_finish(ctx);

    if (rb) {
        struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
        ctx->Driver.UnmapRenderbuffer(ctx, rb);
        srb->Map = NULL;
    }
}
示例#2
0
/**
 * Do software-based glCopyPixels.
 * By time we get here, all parameters will have been error-checked.
 */
void
_swrast_CopyPixels( GLcontext *ctx,
		    GLint srcx, GLint srcy, GLsizei width, GLsizei height,
		    GLint destx, GLint desty, GLenum type )
{
   SWcontext *swrast = SWRAST_CONTEXT(ctx);
   RENDER_START(swrast,ctx);
      
   if (swrast->NewState)
      _swrast_validate_derived( ctx );

   switch (type) {
   case GL_COLOR:
      if (ctx->Visual.rgbMode) {
         copy_rgba_pixels( ctx, srcx, srcy, width, height, destx, desty );
      }
      else {
         copy_ci_pixels( ctx, srcx, srcy, width, height, destx, desty );
      }
      break;
   case GL_DEPTH:
      copy_depth_pixels( ctx, srcx, srcy, width, height, destx, desty );
      break;
   case GL_STENCIL:
      copy_stencil_pixels( ctx, srcx, srcy, width, height, destx, desty );
      break;
   case GL_DEPTH_STENCIL_EXT:
      copy_depth_stencil_pixels(ctx, srcx, srcy, width, height, destx, desty);
      break;
   default:
      _mesa_problem(ctx, "unexpected type in _swrast_CopyPixels");
   }

   RENDER_FINISH(swrast,ctx);
}
示例#3
0
/**
 * Do software-based glCopyPixels.
 * By time we get here, all parameters will have been error-checked.
 */
void
_swrast_CopyPixels( GLcontext *ctx,
		    GLint srcx, GLint srcy, GLsizei width, GLsizei height,
		    GLint destx, GLint desty, GLenum type )
{
   SWcontext *swrast = SWRAST_CONTEXT(ctx);
   swrast_render_start(ctx);
      
   if (!_mesa_check_conditional_render(ctx))
      return; /* don't copy */

   if (swrast->NewState)
      _swrast_validate_derived( ctx );

   if (!fast_copy_pixels(ctx, srcx, srcy, width, height, destx, desty, type)) {
      switch (type) {
      case GL_COLOR:
         copy_rgba_pixels( ctx, srcx, srcy, width, height, destx, desty );
         break;
      case GL_DEPTH:
         copy_depth_pixels( ctx, srcx, srcy, width, height, destx, desty );
         break;
      case GL_STENCIL:
         copy_stencil_pixels( ctx, srcx, srcy, width, height, destx, desty );
         break;
      case GL_DEPTH_STENCIL_EXT:
         copy_depth_stencil_pixels(ctx, srcx, srcy, width, height, destx, desty);
         break;
      default:
         _mesa_problem(ctx, "unexpected type in _swrast_CopyPixels");
      }
   }

   swrast_render_finish(ctx);
}