diff options
author | Brian Paul <[email protected]> | 2005-09-27 01:25:24 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2005-09-27 01:25:24 +0000 |
commit | 99796464c5f0fdb463c31a0e99b0896089b8bd80 (patch) | |
tree | b5b72714035af70455b65f6dfad4452c39123b76 /src/mesa/swrast/s_drawpix.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_drawpix.c')
-rw-r--r-- | src/mesa/swrast/s_drawpix.c | 56 |
1 files changed, 12 insertions, 44 deletions
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 91ac13b13b3..d908ca4db42 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -517,23 +517,6 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, const GLint desty = y; GLint row, skipPixels; - if (type != GL_BYTE && - type != GL_UNSIGNED_BYTE && - type != GL_SHORT && - type != GL_UNSIGNED_SHORT && - type != GL_INT && - type != GL_UNSIGNED_INT && - type != GL_FLOAT && - type != GL_BITMAP) { - _mesa_error( ctx, GL_INVALID_ENUM, "glDrawPixels(stencil type)"); - return; - } - - if (ctx->DrawBuffer->Visual.stencilBits == 0) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(no stencil buffer)"); - return; - } - /* if width > MAX_WIDTH, have to process image in chunks */ skipPixels = 0; while (skipPixels < width) { @@ -565,8 +548,7 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, spanX, spanY, values, desty, 0); } else { - _swrast_write_stencil_span(ctx, (GLuint) spanWidth, - spanX, spanY, values); + _swrast_write_stencil_span(ctx, spanWidth, spanX, spanY, values); } } skipPixels += spanWidth; @@ -592,17 +574,6 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z); - if (type != GL_BYTE - && type != GL_UNSIGNED_BYTE - && type != GL_SHORT - && type != GL_UNSIGNED_SHORT - && type != GL_INT - && type != GL_UNSIGNED_INT - && type != GL_FLOAT) { - _mesa_error(ctx, GL_INVALID_ENUM, "glDrawPixels(type)"); - return; - } - _swrast_span_default_color(ctx, &span); if (ctx->Fog.Enabled) @@ -729,11 +700,6 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); - if (!_mesa_is_legal_format_and_type(ctx, format, type)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glDrawPixels(format or type)"); - return; - } - /* Try an optimized glDrawPixels first */ if (fast_draw_pixels(ctx, x, y, width, height, format, type, unpack, pixels)) return; @@ -874,9 +840,9 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, } - -/* - * Execute glDrawPixels +/** + * Execute software-based glDrawPixels. + * By time we get here, all error checking will have been done. */ void _swrast_DrawPixels( GLcontext *ctx, @@ -940,7 +906,7 @@ _swrast_DrawPixels( GLcontext *ctx, draw_rgba_pixels(ctx, x, y, width, height, format, type, unpack, pixels); break; default: - _mesa_error( ctx, GL_INVALID_ENUM, "glDrawPixels(format)" ); + _mesa_problem(ctx, "unexpected format in _swrast_DrawPixels"); /* don't return yet, clean-up */ } @@ -978,9 +944,11 @@ _swrast_DrawDepthPixelsMESA( GLcontext *ctx, switch (colorFormat) { case GL_COLOR_INDEX: if (ctx->Visual.rgbMode) - draw_rgba_pixels(ctx, x,y, width, height, colorFormat, colorType, unpack, colors); + draw_rgba_pixels(ctx, x,y, width, height, colorFormat, colorType, + unpack, colors); else - draw_index_pixels(ctx, x, y, width, height, colorType, unpack, colors); + draw_index_pixels(ctx, x, y, width, height, colorType, + unpack, colors); break; case GL_RED: case GL_GREEN: @@ -993,11 +961,11 @@ _swrast_DrawDepthPixelsMESA( GLcontext *ctx, case GL_RGBA: case GL_BGRA: case GL_ABGR_EXT: - draw_rgba_pixels(ctx, x, y, width, height, colorFormat, colorType, unpack, colors); + draw_rgba_pixels(ctx, x, y, width, height, colorFormat, colorType, + unpack, colors); break; default: - _mesa_error( ctx, GL_INVALID_ENUM, - "glDrawDepthPixelsMESA(colorFormat)" ); + _mesa_problem(ctx, "unexpected format in glDrawDepthPixelsMESA"); } RENDER_FINISH(swrast,ctx); |