diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2005-01-27 14:08:45 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2005-01-27 14:08:45 +0000 |
commit | b17f1760231be375a17756e4e39e5b60241a7e19 (patch) | |
tree | 68d5f69774b7b03be2c9ca89efeef36e81c754cf | |
parent | 2ea7a7dc413c324a6544ea046dab5956fd4627c0 (diff) |
Add back in a fixed GL_RGB->argb8888 conversion.
-rw-r--r-- | src/mesa/main/texstore.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 97b40b09d4..221e9a0611 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -574,7 +574,7 @@ static void swizzle_copy(GLubyte *dst, break; case 3: for (i = 0; i < count; i++) { - COPY_4UBV(tmp, src); + COPY_4UBV(tmp, src); src += srcComponents; dst[0] = tmp[map[0]]; dst[1] = tmp[map[1]]; @@ -584,7 +584,7 @@ static void swizzle_copy(GLubyte *dst, break; case 2: for (i = 0; i < count; i++) { - COPY_4UBV(tmp, src); + COPY_4UBV(tmp, src); src += srcComponents; dst[0] = tmp[map[0]]; dst[1] = tmp[map[1]]; @@ -1179,6 +1179,36 @@ _mesa_texstore_argb8888(STORE_PARAMS) srcAddr, srcPacking); } else if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_argb8888 && + srcFormat == GL_RGB && + 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 * 3 + BCOMP]; + dstRow[col * 4 + 1] = srcRow[col * 3 + GCOMP]; + dstRow[col * 4 + 2] = srcRow[col * 3 + RCOMP]; + dstRow[col * 4 + 3] = 0xff; + } + dstRow += dstRowStride; + srcRow += srcRowStride; + } + dstImage += dstImageStride; + } + } + else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_argb8888 && srcType == GL_UNSIGNED_BYTE && |