From eda1d08f76f0636b9a273f3c673214f9c5def11d Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 28 Jan 2009 11:29:49 +0000 Subject: [PATCH] Fix rectangles_with_multitexture_coords for sliced without tex coords When the texture is sliced it drops back to a fallback function and passes it the texture coordinates from the rectangle. However if no tex coords are given it would crash. Now it passes the default 0.0->1.0 tex coords instead. --- clutter/cogl/gl/cogl-texture.c | 23 +++++++++++++++-------- clutter/cogl/gles/cogl-texture.c | 23 +++++++++++++++-------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/clutter/cogl/gl/cogl-texture.c b/clutter/cogl/gl/cogl-texture.c index c324154ba..96f0b5dbe 100644 --- a/clutter/cogl/gl/cogl-texture.c +++ b/clutter/cogl/gl/cogl-texture.c @@ -2674,14 +2674,21 @@ _cogl_rectangles_with_multitexture_coords ( first_layer = layers->data; tex_handle = cogl_material_layer_get_texture (first_layer); texture = _cogl_texture_pointer_from_handle (tex_handle); - _cogl_texture_sliced_quad (texture, - material, - rects[i].x_1, rects[i].y_1, - rects[i].x_2, rects[i].y_2, - rects[i].tex_coords[0], - rects[i].tex_coords[1], - rects[i].tex_coords[2], - rects[i].tex_coords[3]); + if (rects[i].tex_coords) + _cogl_texture_sliced_quad (texture, + material, + rects[i].x_1, rects[i].y_1, + rects[i].x_2, rects[i].y_2, + rects[i].tex_coords[0], + rects[i].tex_coords[1], + rects[i].tex_coords[2], + rects[i].tex_coords[3]); + else + _cogl_texture_sliced_quad (texture, + material, + rects[i].x_1, rects[i].y_1, + rects[i].x_2, rects[i].y_2, + 0.0f, 0.0f, 1.0f, 1.0f); } } diff --git a/clutter/cogl/gles/cogl-texture.c b/clutter/cogl/gles/cogl-texture.c index 7f7242cfa..05a4eb238 100644 --- a/clutter/cogl/gles/cogl-texture.c +++ b/clutter/cogl/gles/cogl-texture.c @@ -2784,14 +2784,21 @@ _cogl_rectangles_with_multitexture_coords ( tex_handle = cogl_material_layer_get_texture ((CoglHandle)layers->data); texture = _cogl_texture_pointer_from_handle (tex_handle); - _cogl_texture_sliced_quad (texture, - material, - rects[i].x1, rects[i].y1, - rects[i].x2, rects[i].y2, - rects[i].tex_coords[0], - rects[i].tex_coords[1], - rects[i].tex_coords[2], - rects[i].tex_coords[3]); + if (rects[i].tex_coords) + _cogl_texture_sliced_quad (texture, + material, + rects[i].x1, rects[i].y1, + rects[i].x2, rects[i].y2, + rects[i].tex_coords[0], + rects[i].tex_coords[1], + rects[i].tex_coords[2], + rects[i].tex_coords[3]); + else + _cogl_texture_sliced_quad (texture, + material, + rects[i].x1, rects[i].y1, + rects[i].x2, rects[i].y2, + 0.0f, 0.0f, 1.0f, 1.0f); } }