summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index b94bfc85388..cee2452eafe 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -686,9 +686,11 @@ st_TexImage(GLcontext * ctx,
{
char *dst = texImage->Data;
const char *src = pixels;
- int i;
+ GLuint i, bw, bh, lines;
+ _mesa_get_format_block_size(texImage->TexFormat, &bw, &bh);
+ lines = (height + bh - 1) / bh;
- for(i = 0; i < height; ++i)
+ for(i = 0; i < lines; ++i)
{
memcpy(dst, src, srcImageStride);
dst += dstRowStride;