diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2005-09-27 01:25:24 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2005-09-27 01:25:24 +0000 |
commit | 99796464c5f0fdb463c31a0e99b0896089b8bd80 (patch) | |
tree | b5b72714035af70455b65f6dfad4452c39123b76 /src/mesa/swrast/s_copypix.c | |
parent | 70c3bebcde336c4cc282bc5dbd33d4180b92771c (diff) |
Lift all the format/type error checking out of the _swrast_Draw/Read/CopyPixels
functions into the _mesa_Draw/Read/CopyPixels functions.
Diffstat (limited to 'src/mesa/swrast/s_copypix.c')
-rw-r--r-- | src/mesa/swrast/s_copypix.c | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index 2b4e8450d9..ed6a02ee13 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -517,11 +517,6 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z); - if (fb->Visual.depthBits == 0) { - _mesa_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); - return; - } - /* Determine if copy should be bottom-to-top or top-to-bottom */ if (srcy<desty) { /* top-down max-to-min */ @@ -623,11 +618,6 @@ copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset; GLint overlapping; - if (fb->Visual.stencilBits == 0) { - _mesa_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); - return; - } - if (!rb) { /* no readbuffer - OK */ return; @@ -709,12 +699,14 @@ copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, } - +/** + * 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 ) + GLint destx, GLint desty, GLenum type ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); RENDER_START(swrast,ctx); @@ -722,20 +714,23 @@ _swrast_CopyPixels( GLcontext *ctx, if (swrast->NewState) _swrast_validate_derived( ctx ); - if (type == GL_COLOR && ctx->Visual.rgbMode) { - copy_rgba_pixels( ctx, srcx, srcy, width, height, destx, desty ); - } - else if (type == GL_COLOR && !ctx->Visual.rgbMode) { - copy_ci_pixels( ctx, srcx, srcy, width, height, destx, desty ); - } - else if (type == GL_DEPTH) { + 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 ); - } - else if (type == GL_STENCIL) { + break; + case GL_STENCIL: copy_stencil_pixels( ctx, srcx, srcy, width, height, destx, desty ); - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glCopyPixels" ); + break; + default: + _mesa_problem(ctx, "unexpected type in _swrast_CopyPixels"); } RENDER_FINISH(swrast,ctx); |