diff options
author | Brian Paul <[email protected]> | 2004-11-10 15:46:52 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2004-11-10 15:46:52 +0000 |
commit | 60909388ab136d849d99eab49e782a53772a618f (patch) | |
tree | 84a981ea2e79b5e6477d05991119a23efa4429a5 /src/mesa/swrast | |
parent | f00d7edd746e4d1eec2d497419f21fb3b04f8bd4 (diff) |
GL_(UN)PACK_SKIP_IMAGES should only be applied to 3D texture pack/unpacking
and ignored for 1D and 2D images.
Need to pass in image dimensions (1,2,3) to the _mesa_image_address() function.
This change gets propogated to some other routines.
Also added new _mesa_image_address[123]d() convenience functions.
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r-- | src/mesa/swrast/s_bitmap.c | 10 | ||||
-rw-r--r-- | src/mesa/swrast/s_drawpix.c | 42 | ||||
-rw-r--r-- | src/mesa/swrast/s_readpix.c | 30 |
3 files changed, 41 insertions, 41 deletions
diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c index be728911b69..1afb4875468 100644 --- a/src/mesa/swrast/s_bitmap.c +++ b/src/mesa/swrast/s_bitmap.c @@ -58,7 +58,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, if (unpack->BufferObj->Name) { /* unpack from PBO */ GLubyte *buf; - if (!_mesa_validate_pbo_access(unpack, width, height, 1, + if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, GL_COLOR_INDEX, GL_BITMAP, (GLvoid *) bitmap)) { _mesa_error(ctx, GL_INVALID_OPERATION,"glBitmap(invalid PBO access)"); @@ -104,8 +104,8 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, _swrast_span_default_texcoords(ctx, &span); for (row = 0; row < height; row++, span.y++) { - const GLubyte *src = (const GLubyte *) _mesa_image_address( unpack, - bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 ); + const GLubyte *src = (const GLubyte *) _mesa_image_address2d(unpack, + bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, row, 0); if (unpack->LsbFirst) { /* Lsb first */ @@ -226,8 +226,8 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, _swrast_span_default_texcoords(ctx, &span); for (row=0; row<height; row++, span.y++) { - const GLubyte *src = (const GLubyte *) _mesa_image_address( unpack, - bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 ); + const GLubyte *src = (const GLubyte *) _mesa_image_address2d(unpack, + bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, row, 0); if (unpack->LsbFirst) { /* Lsb first */ diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 74c820c43b8..5b0a24bfb29 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -476,10 +476,10 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y, ? MAX_WIDTH : (width - skipPixels); ASSERT(spanEnd <= MAX_WIDTH); for (row = 0; row < height; row++, spanY++) { - const GLvoid *source = _mesa_image_address(unpack, pixels, - width, height, - GL_COLOR_INDEX, type, - 0, row, skipPixels); + const GLvoid *source = _mesa_image_address2d(unpack, pixels, + width, height, + GL_COLOR_INDEX, type, + row, skipPixels); _mesa_unpack_index_span(ctx, spanEnd, GL_UNSIGNED_INT, span.array->index, type, source, unpack, ctx->_ImageTransferState); @@ -543,10 +543,10 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, GLstencil values[MAX_WIDTH]; GLenum destType = (sizeof(GLstencil) == sizeof(GLubyte)) ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT; - const GLvoid *source = _mesa_image_address(unpack, pixels, - width, height, - GL_COLOR_INDEX, type, - 0, row, skipPixels); + const GLvoid *source = _mesa_image_address2d(unpack, pixels, + width, height, + GL_COLOR_INDEX, type, + row, skipPixels); _mesa_unpack_index_span(ctx, spanWidth, destType, values, type, source, unpack, ctx->_ImageTransferState); @@ -616,8 +616,8 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, GLint row, spanY = y; for (row = 0; row < height; row++, spanY++) { const GLushort *zSrc = (const GLushort *) - _mesa_image_address(unpack, pixels, width, height, - GL_DEPTH_COMPONENT, type, 0, row, 0); + _mesa_image_address2d(unpack, pixels, width, height, + GL_DEPTH_COMPONENT, type, row, 0); GLint i; for (i = 0; i < width; i++) span.array->z[i] = zSrc[i]; @@ -638,8 +638,8 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, GLint row, spanY = y; for (row = 0; row < height; row++, spanY++) { const GLuint *zSrc = (const GLuint *) - _mesa_image_address(unpack, pixels, width, height, - GL_DEPTH_COMPONENT, type, 0, row, 0); + _mesa_image_address2d(unpack, pixels, width, height, + GL_DEPTH_COMPONENT, type, row, 0); if (shift == 0) { MEMCPY(span.array->z, zSrc, width * sizeof(GLdepth)); } @@ -667,10 +667,10 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, ASSERT(span.end <= MAX_WIDTH); for (row = 0; row < height; row++, spanY++) { GLfloat floatSpan[MAX_WIDTH]; - const GLvoid *zSrc = _mesa_image_address(unpack, - pixels, width, height, - GL_DEPTH_COMPONENT, type, - 0, row, skipPixels); + const GLvoid *zSrc = _mesa_image_address2d(unpack, + pixels, width, height, + GL_DEPTH_COMPONENT, type, + row, skipPixels); /* Set these for each row since the _swrast_write_* function may * change them while clipping. @@ -776,8 +776,8 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, /* Unpack the image and apply transfer ops up to convolution */ dest = tmpImage; for (row = 0; row < height; row++) { - const GLvoid *source = _mesa_image_address(unpack, - pixels, width, height, format, type, 0, row, 0); + const GLvoid *source = _mesa_image_address2d(unpack, + pixels, width, height, format, type, row, 0); _mesa_unpack_color_span_float(ctx, width, GL_RGBA, (GLfloat *) dest, format, type, source, unpack, transferOps & IMAGE_PRE_CONVOLUTION_BITS); @@ -819,8 +819,8 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, ASSERT(span.end <= MAX_WIDTH); for (row = 0; row < height; row++, spanY++) { - const GLvoid *source = _mesa_image_address(unpack, - pixels, width, height, format, type, 0, row, skipPixels); + const GLvoid *source = _mesa_image_address2d(unpack, + pixels, width, height, format, type, row, skipPixels); /* Set these for each row since the _swrast_write_* function may * change them while clipping. @@ -888,7 +888,7 @@ _swrast_DrawPixels( GLcontext *ctx, if (unpack->BufferObj->Name) { /* unpack from PBO */ GLubyte *buf; - if (!_mesa_validate_pbo_access(unpack, width, height, 1, + if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, format, type, pixels)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(invalid PBO access)"); diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index aec796e79a6..7d8112fb9b3 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -84,8 +84,8 @@ read_index_pixels( GLcontext *ctx, (*swrast->Driver.ReadCI32Span)(ctx, readWidth, x, y + i, index); - dest = _mesa_image_address(packing, pixels, width, height, - GL_COLOR_INDEX, type, 0, i, 0); + dest = _mesa_image_address2d(packing, pixels, width, height, + GL_COLOR_INDEX, type, i, 0); _mesa_pack_index_span(ctx, readWidth, type, dest, index, &ctx->Pack, ctx->_ImageTransferState); @@ -138,8 +138,8 @@ read_depth_pixels( GLcontext *ctx, GLint j; for (j=0;j<height;j++,y++) { GLdepth depth[MAX_WIDTH]; - GLushort *dst = (GLushort*) _mesa_image_address( packing, pixels, - width, height, GL_DEPTH_COMPONENT, type, 0, j, 0 ); + GLushort *dst = (GLushort*) _mesa_image_address2d(packing, pixels, + width, height, GL_DEPTH_COMPONENT, type, j, 0); GLint i; _swrast_read_depth_span(ctx, width, x, y, depth); for (i = 0; i < width; i++) @@ -151,8 +151,8 @@ read_depth_pixels( GLcontext *ctx, /* Special case: directly read 32-bit unsigned depth values. */ GLint j; for (j=0;j<height;j++,y++) { - GLdepth *dst = (GLdepth *) _mesa_image_address( packing, pixels, - width, height, GL_DEPTH_COMPONENT, type, 0, j, 0 ); + GLdepth *dst = (GLdepth *) _mesa_image_address2d(packing, pixels, + width, height, GL_DEPTH_COMPONENT, type, j, 0); _swrast_read_depth_span(ctx, width, x, y, dst); } } @@ -165,8 +165,8 @@ read_depth_pixels( GLcontext *ctx, _swrast_read_depth_span_float(ctx, readWidth, x, y, depth); - dest = _mesa_image_address(packing, pixels, width, height, - GL_DEPTH_COMPONENT, type, 0, j, 0); + dest = _mesa_image_address2d(packing, pixels, width, height, + GL_DEPTH_COMPONENT, type, j, 0); _mesa_pack_depth_span(ctx, readWidth, (GLdepth *) dest, type, depth, packing); @@ -215,8 +215,8 @@ read_stencil_pixels( GLcontext *ctx, _swrast_read_stencil_span(ctx, readWidth, x, y, stencil); - dest = _mesa_image_address(packing, pixels, width, height, - GL_STENCIL_INDEX, type, 0, j, 0); + dest = _mesa_image_address2d(packing, pixels, width, height, + GL_STENCIL_INDEX, type, j, 0); _mesa_pack_stencil_span(ctx, readWidth, type, dest, stencil, packing); } @@ -423,8 +423,8 @@ read_rgba_pixels( GLcontext *ctx, src = convImage; for (row = 0; row < height; row++) { GLvoid *dest; - dest = _mesa_image_address(packing, pixels, readWidth, height, - format, type, 0, row, 0); + dest = _mesa_image_address2d(packing, pixels, readWidth, height, + format, type, row, 0); _mesa_pack_rgba_span_float(ctx, readWidth, (const GLfloat (*)[4]) src, format, type, dest, packing, @@ -449,8 +449,8 @@ read_rgba_pixels( GLcontext *ctx, } _mesa_map_ci_to_rgba_chan(ctx, readWidth, index, rgba); } - dst = _mesa_image_address(packing, pixels, width, height, - format, type, 0, row, 0); + dst = _mesa_image_address2d(packing, pixels, width, height, + format, type, row, 0); if (ctx->Visual.redBits < CHAN_BITS || ctx->Visual.greenBits < CHAN_BITS || ctx->Visual.blueBits < CHAN_BITS) { @@ -510,7 +510,7 @@ _swrast_ReadPixels( GLcontext *ctx, if (clippedPacking.BufferObj->Name) { /* pack into PBO */ GLubyte *buf; - if (!_mesa_validate_pbo_access(&clippedPacking, width, height, 1, + if (!_mesa_validate_pbo_access(2, &clippedPacking, width, height, 1, format, type, pixels)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(invalid PBO access)"); |