diff options
author | Michal Krol <[email protected]> | 2010-03-10 15:49:30 +0100 |
---|---|---|
committer | Michal Krol <[email protected]> | 2010-03-10 15:49:30 +0100 |
commit | 3ce4375912c8ea488460e593e07c5bb15b92dca9 (patch) | |
tree | 1011fa439bd829fd46a44fd99478135848800e73 /src/mesa/swrast/s_drawpix.c | |
parent | f59f28093ea827bd234d8e1a36bdd56a9fce5f09 (diff) | |
parent | 9b348d0ed125a22be3f318ac60cef6f201edfdab (diff) |
Merge branch 'master' into gallium-sampler-view
Conflicts:
src/gallium/auxiliary/Makefile
src/gallium/auxiliary/SConscript
src/gallium/auxiliary/tgsi/tgsi_exec.c
src/gallium/auxiliary/util/u_blitter.c
src/gallium/drivers/i915/i915_context.h
src/gallium/drivers/i965/brw_context.h
src/gallium/drivers/llvmpipe/lp_context.h
src/gallium/drivers/nv50/nv50_context.h
src/gallium/drivers/nv50/nv50_state_validate.c
src/gallium/drivers/nv50/nv50_tex.c
src/gallium/drivers/r300/r300_blit.c
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/softpipe/sp_context.h
src/gallium/drivers/svga/svga_context.h
src/gallium/drivers/svga/svga_pipe_sampler.c
Diffstat (limited to 'src/mesa/swrast/s_drawpix.c')
-rw-r--r-- | src/mesa/swrast/s_drawpix.c | 93 |
1 files changed, 8 insertions, 85 deletions
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 248d6cc1c04..3cec3a7a2ba 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -267,7 +267,7 @@ fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y, if (format == GL_COLOR_INDEX && type == GL_UNSIGNED_BYTE) { const GLubyte *src = (const GLubyte *) pixels + unpack.SkipRows * unpack.RowLength + unpack.SkipPixels; - if (ctx->Visual.rgbMode && rbType == GL_UNSIGNED_BYTE) { + if (rbType == GL_UNSIGNED_BYTE) { /* convert ubyte/CI data to ubyte/RGBA */ if (simpleZoom) { GLint row; @@ -299,22 +299,6 @@ fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y, } return GL_TRUE; } - else if (!ctx->Visual.rgbMode && rbType == GL_UNSIGNED_INT) { - /* write CI data to CI frame buffer */ - GLint row; - if (simpleZoom) { - for (row = 0; row < drawHeight; row++) { - GLuint index32[MAX_WIDTH]; - GLint col; - for (col = 0; col < drawWidth; col++) - index32[col] = src[col]; - rb->PutRow(ctx, rb, drawWidth, destX, destY, index32, NULL); - src += unpack.RowLength; - destY += yStep; - } - return GL_TRUE; - } - } } /* can't handle this pixel format and/or data type */ @@ -324,57 +308,6 @@ fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y, /* - * Draw color index image. - */ -static void -draw_index_pixels( GLcontext *ctx, GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels ) -{ - const GLint imgX = x, imgY = y; - const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; - GLint row, skipPixels; - SWspan span; - - INIT_SPAN(span, GL_BITMAP); - span.arrayMask = SPAN_INDEX; - _swrast_span_default_attribs(ctx, &span); - - /* - * General solution - */ - skipPixels = 0; - while (skipPixels < width) { - const GLint spanWidth = MIN2(width - skipPixels, MAX_WIDTH); - ASSERT(spanWidth <= MAX_WIDTH); - for (row = 0; row < height; row++) { - const GLvoid *source = _mesa_image_address2d(unpack, pixels, - width, height, - GL_COLOR_INDEX, type, - row, skipPixels); - _mesa_unpack_index_span(ctx, spanWidth, GL_UNSIGNED_INT, - span.array->index, type, source, unpack, - ctx->_ImageTransferState); - - /* These may get changed during writing/clipping */ - span.x = x + skipPixels; - span.y = y + row; - span.end = spanWidth; - - if (zoom) - _swrast_write_zoomed_index_span(ctx, imgX, imgY, &span); - else - _swrast_write_index_span(ctx, &span); - } - skipPixels += spanWidth; - } -} - - - -/* * Draw stencil image. */ static void @@ -441,7 +374,6 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, && ctx->DrawBuffer->Visual.depthBits == 16 && !scaleOrBias && !zoom - && ctx->Visual.rgbMode && width <= MAX_WIDTH && !unpack->SwapBytes) { /* Special case: directly write 16-bit depth values */ @@ -462,7 +394,6 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, else if (type == GL_UNSIGNED_INT && !scaleOrBias && !zoom - && ctx->Visual.rgbMode && width <= MAX_WIDTH && !unpack->SwapBytes) { /* Special case: shift 32-bit values down to Visual.depthBits */ @@ -473,7 +404,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, _mesa_image_address2d(unpack, pixels, width, height, GL_DEPTH_COMPONENT, type, row, 0); if (shift == 0) { - _mesa_memcpy(span.array->z, zSrc, width * sizeof(GLuint)); + memcpy(span.array->z, zSrc, width * sizeof(GLuint)); } else { GLint col; @@ -515,11 +446,8 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, if (zoom) { _swrast_write_zoomed_depth_span(ctx, x, y, &span); } - else if (ctx->Visual.rgbMode) { - _swrast_write_rgba_span(ctx, &span); - } else { - _swrast_write_index_span(ctx, &span); + _swrast_write_rgba_span(ctx, &span); } } skipPixels += spanWidth; @@ -566,14 +494,14 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, GLint row; GLfloat *dest, *tmpImage; - tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); + tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); if (!tmpImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels"); return; } - convImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); + convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); if (!convImage) { - _mesa_free(tmpImage); + free(tmpImage); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels"); return; } @@ -597,7 +525,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, ASSERT(ctx->Pixel.Separable2DEnabled); _mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage); } - _mesa_free(tmpImage); + free(tmpImage); /* continue transfer ops and draw the convolved image */ unpack = &ctx->DefaultPacking; @@ -677,7 +605,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, } if (convImage) { - _mesa_free(convImage); + free(convImage); } } @@ -867,11 +795,6 @@ _swrast_DrawPixels( GLcontext *ctx, draw_depth_pixels( ctx, x, y, width, height, type, unpack, pixels ); break; case GL_COLOR_INDEX: - if (ctx->Visual.rgbMode) - draw_rgba_pixels(ctx, x,y, width, height, format, type, unpack, pixels); - else - draw_index_pixels(ctx, x, y, width, height, type, unpack, pixels); - break; case GL_RED: case GL_GREEN: case GL_BLUE: |