[cogl] Don't allow calling cogl_set_source_texture with an INVALID_HANDLE

Although the underlying materials should allow layers with INVALID_HANDLES
it shouldn't be necissary to expose that via cogl_set_source_texture() and
it's easier to resolve a warning/crash here than odd artefacts/crashes later
in the pipeline.
This commit is contained in:
Robert Bragg 2009-06-08 12:18:34 +01:00
parent 96827db740
commit 71b62e75d2

View File

@ -1512,6 +1512,8 @@ cogl_set_source_texture (CoglHandle texture_handle)
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
CoglColor white; CoglColor white;
g_return_if_fail (texture_handle != COGL_INVALID_HANDLE);
cogl_material_set_layer (ctx->default_material, 0, texture_handle); cogl_material_set_layer (ctx->default_material, 0, texture_handle);
cogl_color_set_from_4ub (&white, 0xff, 0xff, 0xff, 0xff); cogl_color_set_from_4ub (&white, 0xff, 0xff, 0xff, 0xff);
cogl_material_set_color (ctx->default_material, &white); cogl_material_set_color (ctx->default_material, &white);