From 705fed33eaf60341b6ebc7c0d202dab3f18543a8 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 15 Sep 2009 18:40:24 +0800 Subject: mesa: Fix a division in _mesa_meta_draw_tex. Both crop rectangle and texture dimensions are integers. Cast to get float division. --- src/mesa/drivers/common/meta.c | 11 +++++++---- 1 file 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; -- cgit v1.2.3