[cogl-texture] Fix order of tex coords when compensating for waste
authorNeil Roberts <neil@linux.intel.com>
Wed, 28 Jan 2009 12:57:06 +0000 (12:57 +0000)
committerNeil Roberts <neil@linux.intel.com>
Wed, 28 Jan 2009 12:57:06 +0000 (12:57 +0000)
When drawing a texture with waste in _cogl_multitexture_unsliced_quad
it scales the texture coordinates so that the waste is not
included. However the formula was the wrong way around so it was
calculating as if the texture coordinates are ordered x1,x2,y1,y2 but
it is actually x1,y1,x2,y2.

clutter/cogl/gl/cogl-texture.c
clutter/cogl/gles/cogl-texture.c

index 06ba7ae..2b25faf 100644 (file)
@@ -2519,9 +2519,9 @@ _cogl_multitexture_unsliced_quad (float        x_1,
       out_tex_coords[0] =
         out_tex_coords[0] * (x_span->size - x_span->waste) / x_span->size;
       out_tex_coords[1] =
-        out_tex_coords[1] * (x_span->size - x_span->waste) / x_span->size;
+        out_tex_coords[1] * (y_span->size - y_span->waste) / y_span->size;
       out_tex_coords[2] =
-        out_tex_coords[2] * (y_span->size - y_span->waste) / y_span->size;
+        out_tex_coords[2] * (x_span->size - x_span->waste) / x_span->size;
       out_tex_coords[3] =
         out_tex_coords[3] * (y_span->size - y_span->waste) / y_span->size;
 
index 1300b1f..661af23 100644 (file)
@@ -2634,9 +2634,9 @@ _cogl_multitexture_unsliced_quad (float        x1,
       out_tex_coords[0] =
         out_tex_coords[0] * (x_span->size - x_span->waste) / x_span->size;
       out_tex_coords[1] =
-        out_tex_coords[1] * (x_span->size - x_span->waste) / x_span->size;
+        out_tex_coords[1] * (y_span->size - y_span->waste) / y_span->size;
       out_tex_coords[2] =
-        out_tex_coords[2] * (y_span->size - y_span->waste) / y_span->size;
+        out_tex_coords[2] * (x_span->size - x_span->waste) / x_span->size;
       out_tex_coords[3] =
         out_tex_coords[3] * (y_span->size - y_span->waste) / y_span->size;
     }