From f4465ccb05480647a9418dd56a6c6ea511315791 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 26 Nov 2008 16:35:25 +0000 Subject: [PATCH] * clutter/cogl/gl/cogl-texture.c (cogl_texture_rectangle): Fixed the test for whether to use hardware tiling. Previously it assumed that texture coordinates are in increasing order but this is not the case since bug 1057 was fixed. The texture coordinates are now sorted later. It also allowed negative coordinates which doesn't make sense if the texture has waste. --- gl/cogl-texture.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/gl/cogl-texture.c b/gl/cogl-texture.c index 1af5d8805..bf2eef304 100644 --- a/gl/cogl-texture.c +++ b/gl/cogl-texture.c @@ -2193,28 +2193,19 @@ cogl_texture_rectangle (CoglHandle handle, if (tx1 == tx2 || ty1 == ty2) return; - - /* Pick tiling mode according to hw support */ - if (cogl_features_available (COGL_FEATURE_TEXTURE_NPOT) - && tex->slice_gl_handles->len == 1) - { - _cogl_texture_quad_hw (tex, x1,y1, x2,y2, tx1,ty1, tx2,ty2); - } + + /* If there is only one GL texture and either the texture is NPOT + (no waste) or all of the coordinates are in the range [0,1] then + we can use hardware tiling */ + if (tex->slice_gl_handles->len == 1 + && (cogl_features_available (COGL_FEATURE_TEXTURE_NPOT) + || (tx1 >= 0 && tx1 <= COGL_FIXED_1 + && tx2 >= 0 && tx2 <= COGL_FIXED_1 + && ty1 >= 0 && ty1 <= COGL_FIXED_1 + && ty2 >= 0 && ty2 <= COGL_FIXED_1))) + _cogl_texture_quad_hw (tex, x1,y1, x2,y2, tx1,ty1, tx2,ty2); else - { - if (tex->slice_gl_handles->len == 1 - && tx1 >= -COGL_FIXED_1 - && tx2 <= COGL_FIXED_1 - && ty1 >= -COGL_FIXED_1 - && ty2 <= COGL_FIXED_1) - { - _cogl_texture_quad_hw (tex, x1,y1, x2,y2, tx1,ty1, tx2,ty2); - } - else - { - _cogl_texture_quad_sw (tex, x1,y1, x2,y2, tx1,ty1, tx2,ty2); - } - } + _cogl_texture_quad_sw (tex, x1,y1, x2,y2, tx1,ty1, tx2,ty2); } void