X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fglx%2Frenderpix.c;h=e367a9349c588e1d0cfeeca6eeb483236d616f39;hb=ff2f44d86585e842d2e412e0730a5742441fafe2;hp=8234bbe21f6e7a5ba2cfa60ed09a7c72fdcd0358;hpb=1218430e1200a08cd64b6555d3fd1fd0274ad9e5;p=mesa.git diff --git a/src/glx/renderpix.c b/src/glx/renderpix.c index 8234bbe21f6..e367a9349c5 100644 --- a/src/glx/renderpix.c +++ b/src/glx/renderpix.c @@ -76,10 +76,6 @@ * Modify this function so that \c NULL images are sent using * \c __glXSendLargeChunk instead of __glXSendLargeCommand. Doing this * will eliminate the need to allocate a buffer for that case. - * - * \bugs - * The \c fastImageUnpack path, which is thankfully never used, is completely - * broken. */ void __glXSendLargeImage(struct glx_context * gc, GLint compsize, GLint dim, @@ -87,48 +83,38 @@ __glXSendLargeImage(struct glx_context * gc, GLint compsize, GLint dim, GLenum format, GLenum type, const GLvoid * src, GLubyte * pc, GLubyte * modes) { - if (!gc->fastImageUnpack || (src == NULL)) { - /* Allocate a temporary holding buffer */ - GLubyte *buf = (GLubyte *) Xmalloc(compsize); - if (!buf) { - __glXSetError(gc, GL_OUT_OF_MEMORY); - return; - } + /* Allocate a temporary holding buffer */ + GLubyte *buf = malloc(compsize); + if (!buf) { + __glXSetError(gc, GL_OUT_OF_MEMORY); + return; + } - /* Apply pixel store unpack modes to copy data into buf */ - if (src != NULL) { - (*gc->fillImage) (gc, dim, width, height, depth, format, type, - src, buf, modes); - } - else { - if (dim < 3) { - (void) memcpy(modes, __glXDefaultPixelStore + 4, 20); - } - else { - (void) memcpy(modes, __glXDefaultPixelStore + 0, 36); - } - } + /* Apply pixel store unpack modes to copy data into buf */ + if (src != NULL) { + __glFillImage(gc, dim, width, height, depth, format, type, + src, buf, modes); + } + else { + if (dim < 3) { + (void) memcpy(modes, __glXDefaultPixelStore + 4, 20); + } + else { + (void) memcpy(modes, __glXDefaultPixelStore + 0, 36); + } + } - /* Send large command */ - __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, buf, compsize); + /* Send large command */ + __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, buf, compsize); - /* Free buffer */ - Xfree((char *) buf); - } - else { - /* Just send the data straight as is */ - __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, pc, compsize); - } + /* Free buffer */ + free((char *) buf); } /************************************************************************/ /** * Implement GLX protocol for \c glSeparableFilter2D. - * - * \bugs - * The \c fastImageUnpack path, which is thankfully never used, is completely - * broken. */ void __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat, @@ -161,13 +147,12 @@ __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat, __GLX_PUT_LONG(20, type); pc += hdrlen; if (compsize > 0) { - (*gc->fillImage) (gc, 1, width, 1, 1, format, type, - row, pc, pixelHeaderPC); + __glFillImage(gc, 1, width, 1, 1, format, type, row, pc, + pixelHeaderPC); pc += image1len; } if (compsize2 > 0) { - (*gc->fillImage) (gc, 1, height, 1, 1, format, type, - column, pc, NULL); + __glFillImage(gc, 1, height, 1, 1, format, type, column, pc, NULL); pc += image2len; } if ((compsize == 0) && (compsize2 == 0)) { @@ -177,6 +162,7 @@ __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat, __GLX_END(0); } else { + GLubyte *buf; const GLint bufsize = image1len + image2len; /* Use GLXRenderLarge protocol to send command */ @@ -190,29 +176,22 @@ __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat, __GLX_PUT_LONG(20, type); pc += hdrlen; - if (!gc->fastImageUnpack) { - /* Allocate a temporary holding buffer */ - GLubyte *buf = (GLubyte *) Xmalloc(bufsize); - if (!buf) { - __glXSetError(gc, GL_OUT_OF_MEMORY); - return; - } - (*gc->fillImage) (gc, 1, width, 1, 1, format, type, row, buf, - pixelHeaderPC); + /* Allocate a temporary holding buffer */ + buf = malloc(bufsize); + if (!buf) { + __glXSetError(gc, GL_OUT_OF_MEMORY); + return; + } + __glFillImage(gc, 1, width, 1, 1, format, type, row, buf, + pixelHeaderPC); - (*gc->fillImage) (gc, 1, height, 1, 1, format, type, column, - buf + image1len, pixelHeaderPC); + __glFillImage(gc, 1, height, 1, 1, format, type, column, + buf + image1len, pixelHeaderPC); - /* Send large command */ - __glXSendLargeCommand(gc, gc->pc, (GLint) (pc - gc->pc), buf, - bufsize); - /* Free buffer */ - Xfree((char *) buf); - } - else { - /* Just send the data straight as is */ - __glXSendLargeCommand(gc, gc->pc, (GLint) (pc - gc->pc), pc, - bufsize); - } + /* Send large command */ + __glXSendLargeCommand(gc, gc->pc, (GLint) (pc - gc->pc), buf, + bufsize); + /* Free buffer */ + free((char *) buf); } }