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.
This commit is contained in:
Neil Roberts 2009-01-28 11:29:49 +00:00
parent 7df1987652
commit eda1d08f76
2 changed files with 30 additions and 16 deletions

View File

@ -2674,6 +2674,7 @@ _cogl_rectangles_with_multitexture_coords (
first_layer = layers->data; first_layer = layers->data;
tex_handle = cogl_material_layer_get_texture (first_layer); tex_handle = cogl_material_layer_get_texture (first_layer);
texture = _cogl_texture_pointer_from_handle (tex_handle); texture = _cogl_texture_pointer_from_handle (tex_handle);
if (rects[i].tex_coords)
_cogl_texture_sliced_quad (texture, _cogl_texture_sliced_quad (texture,
material, material,
rects[i].x_1, rects[i].y_1, rects[i].x_1, rects[i].y_1,
@ -2682,6 +2683,12 @@ _cogl_rectangles_with_multitexture_coords (
rects[i].tex_coords[1], rects[i].tex_coords[1],
rects[i].tex_coords[2], rects[i].tex_coords[2],
rects[i].tex_coords[3]); 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);
} }
} }

View File

@ -2784,6 +2784,7 @@ _cogl_rectangles_with_multitexture_coords (
tex_handle = tex_handle =
cogl_material_layer_get_texture ((CoglHandle)layers->data); cogl_material_layer_get_texture ((CoglHandle)layers->data);
texture = _cogl_texture_pointer_from_handle (tex_handle); texture = _cogl_texture_pointer_from_handle (tex_handle);
if (rects[i].tex_coords)
_cogl_texture_sliced_quad (texture, _cogl_texture_sliced_quad (texture,
material, material,
rects[i].x1, rects[i].y1, rects[i].x1, rects[i].y1,
@ -2792,6 +2793,12 @@ _cogl_rectangles_with_multitexture_coords (
rects[i].tex_coords[1], rects[i].tex_coords[1],
rects[i].tex_coords[2], rects[i].tex_coords[2],
rects[i].tex_coords[3]); 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);
} }
} }