diff options
author | marha <marha@users.sourceforge.net> | 2012-02-27 07:40:19 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-02-27 07:40:19 +0100 |
commit | b3e4046e8fdcd369e61c237f8690772bf1d8c64f (patch) | |
tree | 5ff8cf47771eede4f2ea6e7c5980fd584f2b4992 /mesalib/src/mesa/swrast/s_zoom.c | |
parent | b436c1b7e3adefe7068fb030b83ac12a826251d3 (diff) | |
parent | c4f44c07c6662d1ce08603945ccc4fa5afaa742a (diff) | |
download | vcxsrv-b3e4046e8fdcd369e61c237f8690772bf1d8c64f.tar.gz vcxsrv-b3e4046e8fdcd369e61c237f8690772bf1d8c64f.tar.bz2 vcxsrv-b3e4046e8fdcd369e61c237f8690772bf1d8c64f.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
pixman/pixman/pixman-mmx.c
Diffstat (limited to 'mesalib/src/mesa/swrast/s_zoom.c')
-rw-r--r-- | mesalib/src/mesa/swrast/s_zoom.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/mesalib/src/mesa/swrast/s_zoom.c b/mesalib/src/mesa/swrast/s_zoom.c index 73bff482b..768bbbafd 100644 --- a/mesalib/src/mesa/swrast/s_zoom.c +++ b/mesalib/src/mesa/swrast/s_zoom.c @@ -150,7 +150,7 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, zoomedWidth = x1 - x0; ASSERT(zoomedWidth > 0); - ASSERT(zoomedWidth <= MAX_WIDTH); + ASSERT(zoomedWidth <= SWRAST_MAX_WIDTH); /* no pixel arrays! must be horizontal spans. */ ASSERT((span->arrayMask & SPAN_XY) == 0); @@ -362,7 +362,7 @@ _swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY GLint width, GLint spanX, GLint spanY, const GLubyte stencil[]) { - GLubyte zoomedVals[MAX_WIDTH]; + GLubyte *zoomedVals; GLint x0, x1, y0, y1, y; GLint i, zoomedWidth; @@ -373,7 +373,11 @@ _swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY zoomedWidth = x1 - x0; ASSERT(zoomedWidth > 0); - ASSERT(zoomedWidth <= MAX_WIDTH); + ASSERT(zoomedWidth <= SWRAST_MAX_WIDTH); + + zoomedVals = (GLubyte *) malloc(zoomedWidth * sizeof(GLubyte)); + if (!zoomedVals) + return; /* zoom the span horizontally */ for (i = 0; i < zoomedWidth; i++) { @@ -387,6 +391,8 @@ _swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY for (y = y0; y < y1; y++) { _swrast_write_stencil_span(ctx, zoomedWidth, x0, y, zoomedVals); } + + free(zoomedVals); } @@ -401,7 +407,7 @@ _swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY, { struct gl_renderbuffer *rb = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; - GLuint zoomedVals[MAX_WIDTH]; + GLuint *zoomedVals; GLint x0, x1, y0, y1, y; GLint i, zoomedWidth; @@ -412,7 +418,11 @@ _swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY, zoomedWidth = x1 - x0; ASSERT(zoomedWidth > 0); - ASSERT(zoomedWidth <= MAX_WIDTH); + ASSERT(zoomedWidth <= SWRAST_MAX_WIDTH); + + zoomedVals = (GLuint *) malloc(zoomedWidth * sizeof(GLuint)); + if (!zoomedVals) + return; /* zoom the span horizontally */ for (i = 0; i < zoomedWidth; i++) { @@ -427,4 +437,6 @@ _swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY, GLubyte *dst = _swrast_pixel_address(rb, x0, y); _mesa_pack_uint_z_row(rb->Format, zoomedWidth, zoomedVals, dst); } + + free(zoomedVals); } |