2008-11-12 Neil Roberts <neil@linux.intel.com>
+ Bug 1057 - cogl_texture_rectangle doesn't support backward
+ coordinates
+
+ * clutter/cogl/gl/cogl-texture.c: Instead of sorting the vertex
+ and texture coordinates passed to cogl_texture_rectangle, just
+ swap both sets whenever the texture coordinates are backward.
+
+2008-11-12 Neil Roberts <neil@linux.intel.com>
+
* clutter/clutter-rectangle.c (clutter_rectangle_paint): Fixed so
that it doesn't use the alpha value from the border colour to draw
the rectangle
cogl_enable (enable_flags);
+ /* If the texture coordinates are backwards then swap both the
+ geometry and texture coordinates so that the texture will be
+ flipped but we can still use the same algorithm to iterate the
+ slices */
+ if (tx2 < tx1)
+ {
+ CoglFixed temp = x1;
+ x1 = x2;
+ x2 = temp;
+ temp = tx1;
+ tx1 = tx2;
+ tx2 = temp;
+ }
+ if (ty2 < ty1)
+ {
+ CoglFixed temp = y1;
+ y1 = y2;
+ y2 = temp;
+ temp = ty1;
+ ty1 = ty2;
+ ty2 = temp;
+ }
+
/* Scale ratio from texture to quad widths */
tw = COGL_FIXED_FROM_INT (tex->bitmap.width);
th = COGL_FIXED_FROM_INT (tex->bitmap.height);
CoglFixed ty2)
{
CoglTexture *tex;
- CoglFixed tempx;
/* Check if valid texture */
if (!cogl_is_texture (handle))
if (tx1 == tx2 || ty1 == ty2)
return;
- /* Fix quad coord ordering
- (atm this is required for sw tiling to iterate
- over slices properly) */
- if (x1 > x2)
- {
- tempx = x1;
- x1 = x2;
- x2 = tempx;
- }
-
- if (y1 > y2)
- {
- tempx = y1;
- y1 = y2;
- y2 = tempx;
- }
-
- /* Fix texture coord ordering */
- if (tx1 > tx2)
- {
- tempx = tx1;
- tx1 = tx2;
- tx2 = tempx;
- }
-
- if (ty1 > ty2)
- {
- tempx = ty1;
- ty1 = ty2;
- ty2 = tempx;
- }
-
/* Pick tiling mode according to hw support */
if (cogl_features_available (COGL_FEATURE_TEXTURE_NPOT)
&& tex->slice_gl_handles->len == 1)
cogl_enable (enable_flags);
+ /* If the texture coordinates are backwards then swap both the
+ geometry and texture coordinates so that the texture will be
+ flipped but we can still use the same algorithm to iterate the
+ slices */
+ if (tx2 < tx1)
+ {
+ CoglFixed temp = x1;
+ x1 = x2;
+ x2 = temp;
+ temp = tx1;
+ tx1 = tx2;
+ tx2 = temp;
+ }
+ if (ty2 < ty1)
+ {
+ CoglFixed temp = y1;
+ y1 = y2;
+ y2 = temp;
+ temp = ty1;
+ ty1 = ty2;
+ ty2 = temp;
+ }
+
GE( cogl_wrap_glTexCoordPointer (2, GL_FIXED, 0, tex_coords) );
GE( cogl_wrap_glVertexPointer (2, GL_FIXED, 0, quad_coords) );
CoglFixed ty2)
{
CoglTexture *tex;
- CoglFixed tempx;
/* Check if valid texture */
if (!cogl_is_texture (handle))
if (tx1 == tx2 || ty1 == ty2)
return;
- /* Fix quad coord ordering */
- if (x1 > x2)
- {
- tempx = x1;
- x1 = x2;
- x2 = tempx;
- }
-
- if (y1 > y2)
- {
- tempx = y1;
- y1 = y2;
- y2 = tempx;
- }
-
- /* Fix texture coord ordering */
- if (tx1 > tx2)
- {
- tempx = tx1;
- tx1 = tx2;
- tx2 = tempx;
- }
-
- if (ty1 > ty2)
- {
- tempx = ty1;
- ty1 = ty2;
- ty2 = tempx;
- }
-
/* Tile textured quads */
if (tex->slice_gl_handles->len == 1 &&
tx1 >= -COGL_FIXED_1 && tx2 <= COGL_FIXED_1 &&