Commit 705fed33eaf60341b6ebc7c0d202dab3f18543a8.patch

  • avatar
  • Chia-I Wu <olvaffe @gm…l.com>
  • Tue Sep 15 12:44:38 CEST 2009
mesa: Fix a division in _mesa_meta_draw_tex.

Both crop rectangle and texture dimensions are integers.  Cast to get
float division.
  
21352135 const struct gl_texture_object *texObj;
21362136 const struct gl_texture_image *texImage;
21372137 GLfloat s, t, s1, t1;
2138 GLuint tw, th;
21382139
21392140 if (!ctx->Texture.Unit[i]._ReallyEnabled) {
21402141 GLuint j;
21482148
21492149 texObj = ctx->Texture.Unit[i]._Current;
21502150 texImage = texObj->Image[0][texObj->BaseLevel];
2151 tw = texImage->Width2;
2152 th = texImage->Height2;
21512153
2152 s = texObj->CropRect[0] / texImage->Width2;
2153 t = texObj->CropRect[1] / texImage->Height2;
2154 s1 = (texObj->CropRect[0] + texObj->CropRect[2]) / texImage->Width2;
2155 t1 = (texObj->CropRect[1] + texObj->CropRect[3]) / texImage->Height2;
2154 s = (GLfloat) texObj->CropRect[0] / tw;
2155 t = (GLfloat) texObj->CropRect[1] / th;
2156 s1 = (GLfloat) (texObj->CropRect[0] + texObj->CropRect[2]) / tw;
2157 t1 = (GLfloat) (texObj->CropRect[1] + texObj->CropRect[3]) / th;
21562158
21572159 verts[0].st[i][0] = s;
21582160 verts[0].st[i][1] = t;