aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-09-06 08:48:23 +0200
committermarha <marha@users.sourceforge.net>2012-09-06 08:48:23 +0200
commitaa10a08696cae93799fcddae3f0245ceee905e01 (patch)
tree950730c362229584b5e60fc1fe309325b7ba66b1 /mesalib/src/mesa/swrast
parentaf1e359cc622a0c53d5632fb03ef9bd4c17de897 (diff)
downloadvcxsrv-aa10a08696cae93799fcddae3f0245ceee905e01.tar.gz
vcxsrv-aa10a08696cae93799fcddae3f0245ceee905e01.tar.bz2
vcxsrv-aa10a08696cae93799fcddae3f0245ceee905e01.zip
xserver mesa git update 6 sep 2012
Diffstat (limited to 'mesalib/src/mesa/swrast')
-rw-r--r--mesalib/src/mesa/swrast/s_context.c15
-rw-r--r--mesalib/src/mesa/swrast/s_copypix.c10
-rw-r--r--mesalib/src/mesa/swrast/s_depth.c4
-rw-r--r--mesalib/src/mesa/swrast/s_drawpix.c8
-rw-r--r--mesalib/src/mesa/swrast/s_renderbuffer.c12
-rw-r--r--mesalib/src/mesa/swrast/s_texcombine.c8
-rw-r--r--mesalib/src/mesa/swrast/s_texfilter.c2
-rw-r--r--mesalib/src/mesa/swrast/s_texture.c8
-rw-r--r--mesalib/src/mesa/swrast/s_zoom.c4
9 files changed, 31 insertions, 40 deletions
diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c
index 53497bc9c..31a12dade 100644
--- a/mesalib/src/mesa/swrast/s_context.c
+++ b/mesalib/src/mesa/swrast/s_context.c
@@ -720,7 +720,7 @@ GLboolean
_swrast_CreateContext( struct gl_context *ctx )
{
GLuint i;
- SWcontext *swrast = (SWcontext *) calloc(1, sizeof(SWcontext));
+ SWcontext *swrast = calloc(1, sizeof(SWcontext));
#ifdef _OPENMP
const GLuint maxThreads = omp_get_max_threads();
#else
@@ -775,7 +775,7 @@ _swrast_CreateContext( struct gl_context *ctx )
* using multiple threads, it is necessary to have one SpanArrays instance
* per thread.
*/
- swrast->SpanArrays = (SWspanarrays *) malloc(maxThreads * sizeof(SWspanarrays));
+ swrast->SpanArrays = malloc(maxThreads * sizeof(SWspanarrays));
if (!swrast->SpanArrays) {
free(swrast);
return GL_FALSE;
@@ -803,10 +803,10 @@ _swrast_CreateContext( struct gl_context *ctx )
ctx->swrast_context = swrast;
- swrast->stencil_temp.buf1 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
- swrast->stencil_temp.buf2 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
- swrast->stencil_temp.buf3 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
- swrast->stencil_temp.buf4 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
+ swrast->stencil_temp.buf1 = malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
+ swrast->stencil_temp.buf2 = malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
+ swrast->stencil_temp.buf3 = malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
+ swrast->stencil_temp.buf4 = malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
if (!swrast->stencil_temp.buf1 ||
!swrast->stencil_temp.buf2 ||
@@ -829,8 +829,7 @@ _swrast_DestroyContext( struct gl_context *ctx )
}
free( swrast->SpanArrays );
- if (swrast->ZoomedArrays)
- free( swrast->ZoomedArrays );
+ free( swrast->ZoomedArrays );
free( swrast->TexelBuffer );
free(swrast->stencil_temp.buf1);
diff --git a/mesalib/src/mesa/swrast/s_copypix.c b/mesalib/src/mesa/swrast/s_copypix.c
index cf419c328..bbd1f228c 100644
--- a/mesalib/src/mesa/swrast/s_copypix.c
+++ b/mesalib/src/mesa/swrast/s_copypix.c
@@ -139,7 +139,7 @@ copy_rgba_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
span.arrayAttribs = FRAG_BIT_COL0; /* we'll fill in COL0 attrib values */
if (overlapping) {
- tmpImage = (GLfloat *) malloc(width * height * sizeof(GLfloat) * 4);
+ tmpImage = malloc(width * height * sizeof(GLfloat) * 4);
if (!tmpImage) {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
@@ -286,7 +286,7 @@ copy_depth_pixels( struct gl_context *ctx, GLint srcx, GLint srcy,
if (overlapping) {
GLint ssy = sy;
- tmpImage = (GLfloat *) malloc(width * height * sizeof(GLfloat));
+ tmpImage = malloc(width * height * sizeof(GLfloat));
if (!tmpImage) {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
@@ -303,7 +303,7 @@ copy_depth_pixels( struct gl_context *ctx, GLint srcx, GLint srcy,
p = NULL;
}
- depth = (GLfloat *) malloc(width * sizeof(GLfloat));
+ depth = malloc(width * sizeof(GLfloat));
if (!depth) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels()");
goto end;
@@ -383,7 +383,7 @@ copy_stencil_pixels( struct gl_context *ctx, GLint srcx, GLint srcy,
if (overlapping) {
GLint ssy = sy;
- tmpImage = (GLubyte *) malloc(width * height * sizeof(GLubyte));
+ tmpImage = malloc(width * height * sizeof(GLubyte));
if (!tmpImage) {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
@@ -400,7 +400,7 @@ copy_stencil_pixels( struct gl_context *ctx, GLint srcx, GLint srcy,
p = NULL;
}
- stencil = (GLubyte *) malloc(width * sizeof(GLubyte));
+ stencil = malloc(width * sizeof(GLubyte));
if (!stencil) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels()");
goto end;
diff --git a/mesalib/src/mesa/swrast/s_depth.c b/mesalib/src/mesa/swrast/s_depth.c
index 26126a932..969b75f07 100644
--- a/mesalib/src/mesa/swrast/s_depth.c
+++ b/mesalib/src/mesa/swrast/s_depth.c
@@ -311,7 +311,7 @@ _swrast_depth_test_span(struct gl_context *ctx, SWspan *span)
}
else {
/* copy Z buffer values into temp buffer (32-bit Z values) */
- zBufferTemp = (GLuint *) malloc(count * sizeof(GLuint));
+ zBufferTemp = malloc(count * sizeof(GLuint));
if (!zBufferTemp)
return 0;
@@ -422,7 +422,7 @@ _swrast_depth_bounds_test( struct gl_context *ctx, SWspan *span )
GLuint *zBufferTemp;
const GLuint *zBufferVals;
- zBufferTemp = (GLuint *) malloc(count * sizeof(GLuint));
+ zBufferTemp = malloc(count * sizeof(GLuint));
if (!zBufferTemp) {
/* don't generate a stream of OUT_OF_MEMORY errors here */
return GL_FALSE;
diff --git a/mesalib/src/mesa/swrast/s_drawpix.c b/mesalib/src/mesa/swrast/s_drawpix.c
index 1fa64c378..7665408fd 100644
--- a/mesalib/src/mesa/swrast/s_drawpix.c
+++ b/mesalib/src/mesa/swrast/s_drawpix.c
@@ -267,7 +267,7 @@ draw_stencil_pixels( struct gl_context *ctx, GLint x, GLint y,
GLint row;
GLubyte *values;
- values = (GLubyte *) malloc(width * sizeof(GLubyte));
+ values = malloc(width * sizeof(GLubyte));
if (!values) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
return;
@@ -493,9 +493,7 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,
span.array->ChanType = CHAN_TYPE;
}
- if (convImage) {
- free(convImage);
- }
+ free(convImage);
swrast_render_finish(ctx);
}
@@ -592,7 +590,7 @@ draw_depth_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
GLuint *zValues; /* 32-bit Z values */
GLint i;
- zValues = (GLuint *) malloc(width * sizeof(GLuint));
+ zValues = malloc(width * sizeof(GLuint));
if (!zValues) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
return;
diff --git a/mesalib/src/mesa/swrast/s_renderbuffer.c b/mesalib/src/mesa/swrast/s_renderbuffer.c
index e468bdb16..b1fb57823 100644
--- a/mesalib/src/mesa/swrast/s_renderbuffer.c
+++ b/mesalib/src/mesa/swrast/s_renderbuffer.c
@@ -119,10 +119,8 @@ soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
bpp = _mesa_get_format_bytes(rb->Format);
/* free old buffer storage */
- if (srb->Buffer) {
- free(srb->Buffer);
- srb->Buffer = NULL;
- }
+ free(srb->Buffer);
+ srb->Buffer = NULL;
srb->RowStride = width * bpp;
@@ -170,10 +168,8 @@ soft_renderbuffer_delete(struct gl_renderbuffer *rb)
{
struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
- if (srb->Buffer) {
- free(srb->Buffer);
- srb->Buffer = NULL;
- }
+ free(srb->Buffer);
+ srb->Buffer = NULL;
_mesa_delete_renderbuffer(rb);
}
diff --git a/mesalib/src/mesa/swrast/s_texcombine.c b/mesalib/src/mesa/swrast/s_texcombine.c
index 9c745d118..1a2db35e2 100644
--- a/mesalib/src/mesa/swrast/s_texcombine.c
+++ b/mesalib/src/mesa/swrast/s_texcombine.c
@@ -98,14 +98,14 @@ texture_combine( struct gl_context *ctx, GLuint unit,
GLchan (*rgbaChan)[4] = span->array->rgba;
/* alloc temp pixel buffers */
- rgba = (float4_array) malloc(4 * n * sizeof(GLfloat));
+ rgba = malloc(4 * n * sizeof(GLfloat));
if (!rgba) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "texture_combine");
return;
}
for (i = 0; i < numArgsRGB || i < numArgsA; i++) {
- ccolor[i] = (float4_array) malloc(4 * n * sizeof(GLfloat));
+ ccolor[i] = malloc(4 * n * sizeof(GLfloat));
if (!ccolor[i]) {
while (i) {
free(ccolor[i]);
@@ -611,7 +611,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
* thread.
*/
swrast->TexelBuffer =
- (GLfloat *) malloc(ctx->Const.MaxTextureImageUnits * maxThreads *
+ malloc(ctx->Const.MaxTextureImageUnits * maxThreads *
SWRAST_MAX_WIDTH * 4 * sizeof(GLfloat));
if (!swrast->TexelBuffer) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "texture_combine");
@@ -619,7 +619,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
}
}
- primary_rgba = (float4_array) malloc(span->end * 4 * sizeof(GLfloat));
+ primary_rgba = malloc(span->end * 4 * sizeof(GLfloat));
if (!primary_rgba) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "texture_span");
diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c
index 152b1ff3e..0a91cca06 100644
--- a/mesalib/src/mesa/swrast/s_texfilter.c
+++ b/mesalib/src/mesa/swrast/s_texfilter.c
@@ -1618,7 +1618,7 @@ create_filter_table(void)
{
GLuint i;
if (!weightLut) {
- weightLut = (GLfloat *) malloc(WEIGHT_LUT_SIZE * sizeof(GLfloat));
+ weightLut = malloc(WEIGHT_LUT_SIZE * sizeof(GLfloat));
for (i = 0; i < WEIGHT_LUT_SIZE; ++i) {
GLfloat alpha = 2;
diff --git a/mesalib/src/mesa/swrast/s_texture.c b/mesalib/src/mesa/swrast/s_texture.c
index 1b73d46e4..8ae3d5bd0 100644
--- a/mesalib/src/mesa/swrast/s_texture.c
+++ b/mesalib/src/mesa/swrast/s_texture.c
@@ -83,7 +83,7 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx,
* We allocate the array for 1D/2D textures too in order to avoid special-
* case code in the texstore routines.
*/
- swImg->ImageOffsets = (GLuint *) malloc(texImage->Depth * sizeof(GLuint));
+ swImg->ImageOffsets = malloc(texImage->Depth * sizeof(GLuint));
if (!swImg->ImageOffsets)
return GL_FALSE;
@@ -144,10 +144,8 @@ _swrast_free_texture_image_buffer(struct gl_context *ctx,
swImage->Buffer = NULL;
}
- if (swImage->ImageOffsets) {
- free(swImage->ImageOffsets);
- swImage->ImageOffsets = NULL;
- }
+ free(swImage->ImageOffsets);
+ swImage->ImageOffsets = NULL;
}
diff --git a/mesalib/src/mesa/swrast/s_zoom.c b/mesalib/src/mesa/swrast/s_zoom.c
index 9304002d2..24bfa22bf 100644
--- a/mesalib/src/mesa/swrast/s_zoom.c
+++ b/mesalib/src/mesa/swrast/s_zoom.c
@@ -375,7 +375,7 @@ _swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY
ASSERT(zoomedWidth > 0);
ASSERT(zoomedWidth <= SWRAST_MAX_WIDTH);
- zoomedVals = (GLubyte *) malloc(zoomedWidth * sizeof(GLubyte));
+ zoomedVals = malloc(zoomedWidth * sizeof(GLubyte));
if (!zoomedVals)
return;
@@ -420,7 +420,7 @@ _swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY,
ASSERT(zoomedWidth > 0);
ASSERT(zoomedWidth <= SWRAST_MAX_WIDTH);
- zoomedVals = (GLuint *) malloc(zoomedWidth * sizeof(GLuint));
+ zoomedVals = malloc(zoomedWidth * sizeof(GLuint));
if (!zoomedVals)
return;