X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fswrast%2Fs_zoom.c;h=4e04691cd76b9c239385319507034d68d040efa9;hb=c5943d6c1cc4eedbea088bc1f611abc153e90524;hp=a48eae19259c6b90d435a897b67f6b950cc73756;hpb=87a6fe57e85ea5f273e808211a0e61d2b837b8e2;p=mesa.git diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c index a48eae19259..4e04691cd76 100644 --- a/src/mesa/swrast/s_zoom.c +++ b/src/mesa/swrast/s_zoom.c @@ -45,7 +45,7 @@ * \return GL_TRUE if any zoomed pixels visible, GL_FALSE if totally clipped */ static GLboolean -compute_zoomed_bounds(GLcontext *ctx, GLint imageX, GLint imageY, +compute_zoomed_bounds(struct gl_context *ctx, GLint imageX, GLint imageY, GLint spanX, GLint spanY, GLint width, GLint *x0, GLint *x1, GLint *y0, GLint *y1) { @@ -127,7 +127,7 @@ unzoom_x(GLfloat zoomX, GLint imageX, GLint zx) * index/depth_span(). */ static void -zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span, +zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, const GLvoid *src, GLenum format ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -185,15 +185,6 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span, zoomed.arrayAttribs |= FRAG_BIT_COL0; /* we'll produce these values */ ASSERT(span->arrayMask & SPAN_RGBA); } - else if (format == GL_COLOR_INDEX) { - /* copy Z info */ - zoomed.z = span->z; - zoomed.zStep = span->zStep; - /* we'll generate an array of color indexes */ - zoomed.interpMask = span->interpMask & ~SPAN_INDEX; - zoomed.arrayMask |= SPAN_INDEX; - ASSERT(span->arrayMask & SPAN_INDEX); - } else if (format == GL_DEPTH_COMPONENT) { /* Copy color info */ zoomed.red = span->red; @@ -288,16 +279,6 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span, } } } - else if (format == GL_COLOR_INDEX) { - const GLuint *indexes = (const GLuint *) src; - GLint i; - for (i = 0; i < zoomedWidth; i++) { - GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x; - ASSERT(j >= 0); - ASSERT(j < (GLint) span->end); - zoomed.array->index[i] = indexes[j]; - } - } else if (format == GL_DEPTH_COMPONENT) { const GLuint *zValues = (const GLuint *) src; GLint i; @@ -307,8 +288,8 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span, ASSERT(j < (GLint) span->end); zoomed.array->z[i] = zValues[j]; } - /* Now, fall into either the RGB or COLOR_INDEX path below */ - format = ctx->Visual.rgbMode ? GL_RGBA : GL_COLOR_INDEX; + /* Now, fall into the RGB path below */ + format = GL_RGBA; } /* write the span in rows [r0, r1) */ @@ -324,30 +305,14 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span, ((zoomed.array->ChanType == GL_UNSIGNED_SHORT) ? 4 * sizeof(GLushort) : 4 * sizeof(GLfloat)); if (y1 - y0 > 1) { - MEMCPY(rgbaSave, zoomed.array->rgba, zoomed.end * pixelSize); + memcpy(rgbaSave, zoomed.array->rgba, zoomed.end * pixelSize); } for (zoomed.y = y0; zoomed.y < y1; zoomed.y++) { _swrast_write_rgba_span(ctx, &zoomed); zoomed.end = end; /* restore */ if (y1 - y0 > 1) { /* restore the colors */ - MEMCPY(zoomed.array->rgba, rgbaSave, zoomed.end * pixelSize); - } - } - } - else if (format == GL_COLOR_INDEX) { - /* use specular color array for temp storage */ - GLuint *indexSave = (GLuint *) zoomed.array->attribs[FRAG_ATTRIB_FOGC]; - const GLint end = zoomed.end; /* save */ - if (y1 - y0 > 1) { - MEMCPY(indexSave, zoomed.array->index, zoomed.end * sizeof(GLuint)); - } - for (zoomed.y = y0; zoomed.y < y1; zoomed.y++) { - _swrast_write_index_span(ctx, &zoomed); - zoomed.end = end; /* restore */ - if (y1 - y0 > 1) { - /* restore the colors */ - MEMCPY(zoomed.array->index, indexSave, zoomed.end * sizeof(GLuint)); + memcpy(zoomed.array->rgba, rgbaSave, zoomed.end * pixelSize); } } } @@ -355,7 +320,7 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span, void -_swrast_write_zoomed_rgba_span(GLcontext *ctx, GLint imgX, GLint imgY, +_swrast_write_zoomed_rgba_span(struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, const GLvoid *rgba) { zoom_span(ctx, imgX, imgY, span, rgba, GL_RGBA); @@ -363,7 +328,7 @@ _swrast_write_zoomed_rgba_span(GLcontext *ctx, GLint imgX, GLint imgY, void -_swrast_write_zoomed_rgb_span(GLcontext *ctx, GLint imgX, GLint imgY, +_swrast_write_zoomed_rgb_span(struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, const GLvoid *rgb) { zoom_span(ctx, imgX, imgY, span, rgb, GL_RGB); @@ -371,16 +336,7 @@ _swrast_write_zoomed_rgb_span(GLcontext *ctx, GLint imgX, GLint imgY, void -_swrast_write_zoomed_index_span(GLcontext *ctx, GLint imgX, GLint imgY, - const SWspan *span) -{ - zoom_span(ctx, imgX, imgY, span, - (const GLvoid *) span->array->index, GL_COLOR_INDEX); -} - - -void -_swrast_write_zoomed_depth_span(GLcontext *ctx, GLint imgX, GLint imgY, +_swrast_write_zoomed_depth_span(struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span) { zoom_span(ctx, imgX, imgY, span, @@ -393,7 +349,7 @@ _swrast_write_zoomed_depth_span(GLcontext *ctx, GLint imgX, GLint imgY, * No per-fragment operations are applied. */ void -_swrast_write_zoomed_stencil_span(GLcontext *ctx, GLint imgX, GLint imgY, +_swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY, GLint width, GLint spanX, GLint spanY, const GLstencil stencil[]) { @@ -430,7 +386,7 @@ _swrast_write_zoomed_stencil_span(GLcontext *ctx, GLint imgX, GLint imgY, * No per-fragment operations are applied. */ void -_swrast_write_zoomed_z_span(GLcontext *ctx, GLint imgX, GLint imgY, +_swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY, GLint width, GLint spanX, GLint spanY, const GLvoid *z) {