diff options
author | Chia-I Wu <olvaffe@gmail.com> | 2009-09-15 18:40:24 +0800 |
---|---|---|
committer | Chia-I Wu <olvaffe@gmail.com> | 2009-09-15 18:44:38 +0800 |
commit | 705fed33eaf60341b6ebc7c0d202dab3f18543a8 (patch) | |
tree | 50a7dd9b54a0210bb4f11208b87d30ebec52994a | |
parent | 4e547d5155d1943576cc6127e537f78fdb7c6ab7 (diff) |
mesa: Fix a division in _mesa_meta_draw_tex.
Both crop rectangle and texture dimensions are integers. Cast to get
float division.
-rw-r--r-- | src/mesa/drivers/common/meta.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index aff25ce800..5c794ee443 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2135,6 +2135,7 @@ _mesa_meta_draw_tex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, const struct gl_texture_object *texObj; const struct gl_texture_image *texImage; GLfloat s, t, s1, t1; + GLuint tw, th; if (!ctx->Texture.Unit[i]._ReallyEnabled) { GLuint j; @@ -2147,11 +2148,13 @@ _mesa_meta_draw_tex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, texObj = ctx->Texture.Unit[i]._Current; texImage = texObj->Image[0][texObj->BaseLevel]; + tw = texImage->Width2; + th = texImage->Height2; - s = texObj->CropRect[0] / texImage->Width2; - t = texObj->CropRect[1] / texImage->Height2; - s1 = (texObj->CropRect[0] + texObj->CropRect[2]) / texImage->Width2; - t1 = (texObj->CropRect[1] + texObj->CropRect[3]) / texImage->Height2; + s = (GLfloat) texObj->CropRect[0] / tw; + t = (GLfloat) texObj->CropRect[1] / th; + s1 = (GLfloat) (texObj->CropRect[0] + texObj->CropRect[2]) / tw; + t1 = (GLfloat) (texObj->CropRect[1] + texObj->CropRect[3]) / th; verts[0].st[i][0] = s; verts[0].st[i][1] = t; |