diff options
author | marha <marha@users.sourceforge.net> | 2012-02-01 08:27:16 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-02-01 08:27:16 +0100 |
commit | 58ff764d4111bfaa7360c57bc62dd620fbdce06f (patch) | |
tree | adc5c52beb88c10ecb1df7b33983e901afc7dea0 /mesalib/src/mesa/main/format_pack.c | |
parent | c7a181e449c6a2ea5f0ad0514865e7c559dbe6dc (diff) | |
download | vcxsrv-58ff764d4111bfaa7360c57bc62dd620fbdce06f.tar.gz vcxsrv-58ff764d4111bfaa7360c57bc62dd620fbdce06f.tar.bz2 vcxsrv-58ff764d4111bfaa7360c57bc62dd620fbdce06f.zip |
xserver mesa pixman xkbcomp xkeyboard-config git update 1 feb 2012
Diffstat (limited to 'mesalib/src/mesa/main/format_pack.c')
-rw-r--r-- | mesalib/src/mesa/main/format_pack.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c index 85b2c691c..ea1d95ee9 100644 --- a/mesalib/src/mesa/main/format_pack.c +++ b/mesalib/src/mesa/main/format_pack.c @@ -2050,6 +2050,48 @@ _mesa_pack_ubyte_rgba_row(gl_format format, GLuint n, /** + * Pack a 2D image of ubyte RGBA pixels in the given format. + * \param srcRowStride source image row stride in bytes + * \param dstRowStride destination image row stride in bytes + */ +void +_mesa_pack_ubyte_rgba_rect(gl_format format, GLuint width, GLuint height, + const GLubyte *src, GLint srcRowStride, + void *dst, GLint dstRowStride) +{ + pack_ubyte_rgba_row_func packrow = get_pack_ubyte_rgba_row_function(format); + GLubyte *dstUB = (GLubyte *) dst; + GLuint i; + + if (packrow) { + if (srcRowStride == width * 4 * sizeof(GLubyte) && + dstRowStride == _mesa_format_row_stride(format, width)) { + /* do whole image at once */ + packrow(width * height, (const GLubyte (*)[4]) src, dst); + } + else { + /* row by row */ + for (i = 0; i < height; i++) { + packrow(width, (const GLubyte (*)[4]) src, dstUB); + src += srcRowStride; + dstUB += dstRowStride; + } + } + } + else { + /* slower fallback */ + for (i = 0; i < height; i++) { + _mesa_pack_ubyte_rgba_row(format, width, + (const GLubyte (*)[4]) src, dstUB); + src += srcRowStride; + dstUB += dstRowStride; + } + } +} + + + +/** ** Pack float Z pixels **/ |