diff options
author | Brian Paul <[email protected]> | 2011-11-11 07:30:18 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-11-15 07:49:25 -0700 |
commit | 6d68855df133bdd4891e8aa428787b520739e0fe (patch) | |
tree | 4d242ff9bbbc094774792440ae25cff47346568f /src/mesa/main | |
parent | cc502aa9419a6fb127b264dbb131c786281cb8c7 (diff) |
mesa: replace GLstencil with GLubyte
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/mtypes.h | 12 | ||||
-rw-r--r-- | src/mesa/main/pack.c | 23 | ||||
-rw-r--r-- | src/mesa/main/pack.h | 4 | ||||
-rw-r--r-- | src/mesa/main/pixeltransfer.c | 4 | ||||
-rw-r--r-- | src/mesa/main/pixeltransfer.h | 2 |
5 files changed, 12 insertions, 33 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 8495a9c2e63..285ec0783da 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -49,18 +49,6 @@ extern "C" { /** - * Stencil buffer data type. - */ -#if STENCIL_BITS==8 - typedef GLubyte GLstencil; -#elif STENCIL_BITS==16 - typedef GLushort GLstencil; -#else -# error "illegal number of stencil bits" -#endif - - -/** * \name 64-bit extension of GLbitfield. */ /*@{*/ diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c index 539a06c9a07..de29395b0fe 100644 --- a/src/mesa/main/pack.c +++ b/src/mesa/main/pack.c @@ -4586,10 +4586,10 @@ _mesa_unpack_stencil_span( struct gl_context *ctx, GLuint n, void _mesa_pack_stencil_span( struct gl_context *ctx, GLuint n, - GLenum dstType, GLvoid *dest, const GLstencil *source, + GLenum dstType, GLvoid *dest, const GLubyte *source, const struct gl_pixelstore_attrib *dstPacking ) { - GLstencil *stencil = (GLstencil *) malloc(n * sizeof(GLstencil)); + GLubyte *stencil = (GLubyte *) malloc(n * sizeof(GLubyte)); if (!stencil) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "stencil packing"); @@ -4599,23 +4599,14 @@ _mesa_pack_stencil_span( struct gl_context *ctx, GLuint n, if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset || ctx->Pixel.MapStencilFlag) { /* make a copy of input */ - memcpy(stencil, source, n * sizeof(GLstencil)); + memcpy(stencil, source, n * sizeof(GLubyte)); _mesa_apply_stencil_transfer_ops(ctx, n, stencil); source = stencil; } switch (dstType) { case GL_UNSIGNED_BYTE: - if (sizeof(GLstencil) == 1) { - memcpy( dest, source, n ); - } - else { - GLubyte *dst = (GLubyte *) dest; - GLuint i; - for (i=0;i<n;i++) { - dst[i] = (GLubyte) source[i]; - } - } + memcpy(dest, source, n); break; case GL_BYTE: { @@ -5120,11 +5111,11 @@ void _mesa_pack_depth_stencil_span(struct gl_context *ctx,GLuint n, GLenum dstType, GLuint *dest, const GLfloat *depthVals, - const GLstencil *stencilVals, + const GLubyte *stencilVals, const struct gl_pixelstore_attrib *dstPacking) { GLfloat *depthCopy = (GLfloat *) malloc(n * sizeof(GLfloat)); - GLstencil *stencilCopy = (GLstencil *) malloc(n * sizeof(GLstencil)); + GLubyte *stencilCopy = (GLubyte *) malloc(n * sizeof(GLubyte)); GLuint i; if (!depthCopy || !stencilCopy) { @@ -5143,7 +5134,7 @@ _mesa_pack_depth_stencil_span(struct gl_context *ctx,GLuint n, if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset || ctx->Pixel.MapStencilFlag) { - memcpy(stencilCopy, stencilVals, n * sizeof(GLstencil)); + memcpy(stencilCopy, stencilVals, n * sizeof(GLubyte)); _mesa_apply_stencil_transfer_ops(ctx, n, stencilCopy); stencilVals = stencilCopy; } diff --git a/src/mesa/main/pack.h b/src/mesa/main/pack.h index 7a0089c2f2c..b1853cd5909 100644 --- a/src/mesa/main/pack.h +++ b/src/mesa/main/pack.h @@ -113,7 +113,7 @@ _mesa_unpack_stencil_span(struct gl_context *ctx, GLuint n, extern void _mesa_pack_stencil_span(struct gl_context *ctx, GLuint n, - GLenum dstType, GLvoid *dest, const GLstencil *source, + GLenum dstType, GLvoid *dest, const GLubyte *source, const struct gl_pixelstore_attrib *dstPacking); @@ -133,7 +133,7 @@ extern void _mesa_pack_depth_stencil_span(struct gl_context *ctx,GLuint n, GLenum dstType, GLuint *dest, const GLfloat *depthVals, - const GLstencil *stencilVals, + const GLubyte *stencilVals, const struct gl_pixelstore_attrib *dstPacking); diff --git a/src/mesa/main/pixeltransfer.c b/src/mesa/main/pixeltransfer.c index 5e881436afd..5c167e0a90a 100644 --- a/src/mesa/main/pixeltransfer.c +++ b/src/mesa/main/pixeltransfer.c @@ -273,7 +273,7 @@ _mesa_apply_ci_transfer_ops(const struct gl_context *ctx, */ void _mesa_apply_stencil_transfer_ops(const struct gl_context *ctx, GLuint n, - GLstencil stencil[]) + GLubyte stencil[]) { if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset != 0) { const GLint offset = ctx->Pixel.IndexOffset; @@ -300,7 +300,7 @@ _mesa_apply_stencil_transfer_ops(const struct gl_context *ctx, GLuint n, GLuint mask = ctx->PixelMaps.StoS.Size - 1; GLuint i; for (i = 0; i < n; i++) { - stencil[i] = (GLstencil)ctx->PixelMaps.StoS.Map[ stencil[i] & mask ]; + stencil[i] = (GLubyte) ctx->PixelMaps.StoS.Map[ stencil[i] & mask ]; } } } diff --git a/src/mesa/main/pixeltransfer.h b/src/mesa/main/pixeltransfer.h index 8af2e9ee2d8..a8c14757ffa 100644 --- a/src/mesa/main/pixeltransfer.h +++ b/src/mesa/main/pixeltransfer.h @@ -75,7 +75,7 @@ _mesa_apply_ci_transfer_ops(const struct gl_context *ctx, extern void _mesa_apply_stencil_transfer_ops(const struct gl_context *ctx, GLuint n, - GLstencil stencil[]); + GLubyte stencil[]); #endif |