swrast: remove MAX_WIDTH arrays in s_zoom.c
This commit is contained in:
parent
237b2fca7a
commit
0c70d2c5bb
|
@ -362,7 +362,7 @@ _swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY
|
||||||
GLint width, GLint spanX, GLint spanY,
|
GLint width, GLint spanX, GLint spanY,
|
||||||
const GLubyte stencil[])
|
const GLubyte stencil[])
|
||||||
{
|
{
|
||||||
GLubyte zoomedVals[MAX_WIDTH];
|
GLubyte *zoomedVals;
|
||||||
GLint x0, x1, y0, y1, y;
|
GLint x0, x1, y0, y1, y;
|
||||||
GLint i, zoomedWidth;
|
GLint i, zoomedWidth;
|
||||||
|
|
||||||
|
@ -375,6 +375,10 @@ _swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY
|
||||||
ASSERT(zoomedWidth > 0);
|
ASSERT(zoomedWidth > 0);
|
||||||
ASSERT(zoomedWidth <= MAX_WIDTH);
|
ASSERT(zoomedWidth <= MAX_WIDTH);
|
||||||
|
|
||||||
|
zoomedVals = (GLubyte *) malloc(zoomedWidth * sizeof(GLubyte));
|
||||||
|
if (!zoomedVals)
|
||||||
|
return;
|
||||||
|
|
||||||
/* zoom the span horizontally */
|
/* zoom the span horizontally */
|
||||||
for (i = 0; i < zoomedWidth; i++) {
|
for (i = 0; i < zoomedWidth; i++) {
|
||||||
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - spanX;
|
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - spanX;
|
||||||
|
@ -387,6 +391,8 @@ _swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY
|
||||||
for (y = y0; y < y1; y++) {
|
for (y = y0; y < y1; y++) {
|
||||||
_swrast_write_stencil_span(ctx, zoomedWidth, x0, y, zoomedVals);
|
_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 =
|
struct gl_renderbuffer *rb =
|
||||||
ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
|
ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
|
||||||
GLuint zoomedVals[MAX_WIDTH];
|
GLuint *zoomedVals;
|
||||||
GLint x0, x1, y0, y1, y;
|
GLint x0, x1, y0, y1, y;
|
||||||
GLint i, zoomedWidth;
|
GLint i, zoomedWidth;
|
||||||
|
|
||||||
|
@ -414,6 +420,10 @@ _swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY,
|
||||||
ASSERT(zoomedWidth > 0);
|
ASSERT(zoomedWidth > 0);
|
||||||
ASSERT(zoomedWidth <= MAX_WIDTH);
|
ASSERT(zoomedWidth <= MAX_WIDTH);
|
||||||
|
|
||||||
|
zoomedVals = (GLuint *) malloc(zoomedWidth * sizeof(GLuint));
|
||||||
|
if (!zoomedVals)
|
||||||
|
return;
|
||||||
|
|
||||||
/* zoom the span horizontally */
|
/* zoom the span horizontally */
|
||||||
for (i = 0; i < zoomedWidth; i++) {
|
for (i = 0; i < zoomedWidth; i++) {
|
||||||
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - spanX;
|
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - spanX;
|
||||||
|
@ -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);
|
GLubyte *dst = _swrast_pixel_address(rb, x0, y);
|
||||||
_mesa_pack_uint_z_row(rb->Format, zoomedWidth, zoomedVals, dst);
|
_mesa_pack_uint_z_row(rb->Format, zoomedWidth, zoomedVals, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(zoomedVals);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue