aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/texgetimage.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-02-13 08:47:19 +0100
committermarha <marha@users.sourceforge.net>2012-02-13 08:47:19 +0100
commiteaa70945cb3f1a432b8c505ecede9ebc7769f36d (patch)
tree8e44ff4da739e384a2c6a34c1b42ecfb8e212344 /mesalib/src/mesa/main/texgetimage.c
parent474621addc25cb22865c54b70ffbec07c82eb04c (diff)
downloadvcxsrv-eaa70945cb3f1a432b8c505ecede9ebc7769f36d.tar.gz
vcxsrv-eaa70945cb3f1a432b8c505ecede9ebc7769f36d.tar.bz2
vcxsrv-eaa70945cb3f1a432b8c505ecede9ebc7769f36d.zip
libX11 libxcb mesa xserver mkfontscale git update 13 feb 2012
Diffstat (limited to 'mesalib/src/mesa/main/texgetimage.c')
-rw-r--r--mesalib/src/mesa/main/texgetimage.c60
1 files changed, 8 insertions, 52 deletions
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index bff003d24..a02a49156 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -246,23 +246,12 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,
{
GLubyte *srcMap;
GLint srcRowStride;
- GLuint bytes, bw, bh;
-
- bytes = _mesa_get_format_bytes(texFormat);
- _mesa_get_format_block_size(texFormat, &bw, &bh);
ctx->Driver.MapTextureImage(ctx, texImage, 0,
0, 0, width, height,
GL_MAP_READ_BIT,
&srcMap, &srcRowStride);
if (srcMap) {
- /* XXX This line is a bit of a hack to work around the
- * mismatch of compressed row strides as returned by
- * MapTextureImage() vs. what the texture decompression code
- * uses. This will be fixed in the future.
- */
- srcRowStride = srcRowStride * bh / bytes;
-
_mesa_decompress_image(texFormat, width, height,
srcMap, srcRowStride, tempImage);
@@ -270,6 +259,8 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,
}
else {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
+ free(tempImage);
+ return;
}
}
@@ -496,52 +487,17 @@ get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type,
GLboolean memCopy = GL_FALSE;
/*
- * Check if the src/dst formats are compatible.
- * Also note that GL's pixel transfer ops don't apply to glGetTexImage()
- * so we don't have to worry about those.
- * XXX more format combinations could be supported here.
+ * Check if we can use memcpy to copy from the hardware texture
+ * format to the user's format/type.
+ * Note that GL's pixel transfer ops don't apply to glGetTexImage()
*/
if (target == GL_TEXTURE_1D ||
target == GL_TEXTURE_2D ||
target == GL_TEXTURE_RECTANGLE ||
_mesa_is_cube_face(target)) {
- if ((texImage->TexFormat == MESA_FORMAT_ARGB8888 ||
- texImage->TexFormat == MESA_FORMAT_SARGB8) &&
- format == GL_BGRA &&
- (type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV) &&
- !ctx->Pack.SwapBytes &&
- _mesa_little_endian()) {
- memCopy = GL_TRUE;
- }
- else if ((texImage->TexFormat == MESA_FORMAT_AL88 ||
- texImage->TexFormat == MESA_FORMAT_SLA8) &&
- format == GL_LUMINANCE_ALPHA &&
- type == GL_UNSIGNED_BYTE &&
- !ctx->Pack.SwapBytes &&
- _mesa_little_endian()) {
- memCopy = GL_TRUE;
- }
- else if ((texImage->TexFormat == MESA_FORMAT_L8 ||
- texImage->TexFormat == MESA_FORMAT_SL8) &&
- format == GL_LUMINANCE &&
- type == GL_UNSIGNED_BYTE) {
- memCopy = GL_TRUE;
- }
- else if (texImage->TexFormat == MESA_FORMAT_L16 &&
- format == GL_LUMINANCE &&
- type == GL_UNSIGNED_SHORT) {
- memCopy = GL_TRUE;
- }
- else if (texImage->TexFormat == MESA_FORMAT_A8 &&
- format == GL_ALPHA &&
- type == GL_UNSIGNED_BYTE) {
- memCopy = GL_TRUE;
- }
- else if (texImage->TexFormat == MESA_FORMAT_A16 &&
- format == GL_ALPHA &&
- type == GL_UNSIGNED_SHORT) {
- memCopy = GL_TRUE;
- }
+ memCopy = _mesa_format_matches_format_and_type(texImage->TexFormat,
+ format, type,
+ ctx->Pack.SwapBytes);
}
if (memCopy) {