summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 0cec23f2b3..f01053cdac 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -680,7 +680,22 @@ st_TexImage(GLcontext * ctx,
* conversion and copy:
*/
if (compressed_src) {
- memcpy(texImage->Data, pixels, imageSize);
+ const GLuint srcImageStride = _mesa_format_row_stride(texImage->TexFormat, width);
+ if(dstRowStride == srcImageStride)
+ memcpy(texImage->Data, pixels, imageSize);
+ else
+ {
+ char *dst = texImage->Data;
+ const char *src = pixels;
+ int i;
+
+ for(i = 0; i < height; ++i)
+ {
+ memcpy(dst, src, srcImageStride);
+ dst += dstRowStride;
+ src += srcImageStride;
+ }
+ }
}
else {
const GLuint srcImageStride =