diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2005-01-27 16:21:14 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2005-01-27 16:21:14 +0000 |
commit | a2b9062a09dea142926f18a1a474a2aec88c9324 (patch) | |
tree | 41cf60a4f1a4d6a5c604ebaa6b77d66884a9b48b | |
parent | b17f1760231be375a17756e4e39e5b60241a7e19 (diff) |
Also add a fixed GL_RGBA->argb8888 conversion.
-rw-r--r-- | src/mesa/main/texstore.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 221e9a0611..2eb3c0a082 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1209,6 +1209,36 @@ _mesa_texstore_argb8888(STORE_PARAMS) } } else if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_argb8888 && + srcFormat == GL_RGBA && + srcType == GL_UNSIGNED_BYTE) { + + int img, row, col; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + for (img = 0; img < srcDepth; img++) { + const GLint srcRowStride = _mesa_image_row_stride(srcPacking, + srcWidth, srcFormat, srcType); + GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, + srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); + GLubyte *dstRow = dstImage; + for (row = 0; row < srcHeight; row++) { + for (col = 0; col < srcWidth; col++) { + dstRow[col * 4 + 0] = srcRow[col * 4 + BCOMP]; + dstRow[col * 4 + 1] = srcRow[col * 4 + GCOMP]; + dstRow[col * 4 + 2] = srcRow[col * 4 + RCOMP]; + dstRow[col * 4 + 3] = srcRow[col * 4 + ACOMP]; + } + dstRow += dstRowStride; + srcRow += srcRowStride; + } + dstImage += dstImageStride; + } + } + else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_argb8888 && srcType == GL_UNSIGNED_BYTE && |