diff --git a/clutter/cogl/cogl/cogl-color.c b/clutter/cogl/cogl/cogl-color.c index b4a146fdf..a89534e49 100644 --- a/clutter/cogl/cogl/cogl-color.c +++ b/clutter/cogl/cogl/cogl-color.c @@ -163,30 +163,6 @@ cogl_color_premultiply (CoglColor *color) color->blue = (color->blue * color->alpha + 128) / 255; } -void -cogl_set_source_color4ub (guint8 red, - guint8 green, - guint8 blue, - guint8 alpha) -{ - CoglColor c = { 0, }; - - cogl_color_set_from_4ub (&c, red, green, blue, alpha); - cogl_set_source_color (&c); -} - -void -cogl_set_source_color4f (float red, - float green, - float blue, - float alpha) -{ - CoglColor c = { 0, }; - - cogl_color_set_from_4f (&c, red, green, blue, alpha); - cogl_set_source_color (&c); -} - gboolean cogl_color_equal (gconstpointer v1, gconstpointer v2) { diff --git a/clutter/cogl/cogl/cogl-material.c b/clutter/cogl/cogl/cogl-material.c index 576ca063e..231ac3f95 100644 --- a/clutter/cogl/cogl/cogl-material.c +++ b/clutter/cogl/cogl/cogl-material.c @@ -1988,42 +1988,6 @@ _cogl_material_journal_unref (CoglHandle material_handle) cogl_handle_unref (material_handle); } -/* TODO: Should go in cogl.c, but that implies duplication which is also - * not ideal. */ -void -cogl_set_source (CoglHandle material_handle) -{ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - g_return_if_fail (cogl_is_material (material_handle)); - - if (ctx->source_material == material_handle) - return; - - cogl_handle_ref (material_handle); - - if (ctx->source_material) - cogl_handle_unref (ctx->source_material); - - ctx->source_material = material_handle; -} -/* TODO: add cogl_set_front_source (), and cogl_set_back_source () */ - -void -cogl_set_source_texture (CoglHandle texture_handle) -{ - CoglColor white; - - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - g_return_if_fail (texture_handle != COGL_INVALID_HANDLE); - - cogl_material_set_layer (ctx->simple_material, 0, texture_handle); - cogl_color_set_from_4ub (&white, 0xff, 0xff, 0xff, 0xff); - cogl_material_set_color (ctx->simple_material, &white); - cogl_set_source (ctx->simple_material); -} - CoglMaterialFilter cogl_material_layer_get_min_filter (CoglHandle layer_handle) { diff --git a/clutter/cogl/cogl/cogl.c b/clutter/cogl/cogl/cogl.c index 9632ce529..fe9177000 100644 --- a/clutter/cogl/cogl/cogl.c +++ b/clutter/cogl/cogl/cogl.c @@ -3,7 +3,7 @@ * * An object oriented GL/GLES Abstraction/Utility Layer * - * Copyright (C) 2007,2008,2009 Intel Corporation. + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -1057,3 +1057,61 @@ _cogl_driver_error_quark (void) { return g_quark_from_static_string ("cogl-driver-error-quark"); } + +void +cogl_set_source (CoglHandle material_handle) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + g_return_if_fail (cogl_is_material (material_handle)); + + if (ctx->source_material == material_handle) + return; + + cogl_handle_ref (material_handle); + + if (ctx->source_material) + cogl_handle_unref (ctx->source_material); + + ctx->source_material = material_handle; +} + +void +cogl_set_source_texture (CoglHandle texture_handle) +{ + CoglColor white; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + g_return_if_fail (texture_handle != COGL_INVALID_HANDLE); + + cogl_material_set_layer (ctx->simple_material, 0, texture_handle); + cogl_color_set_from_4ub (&white, 0xff, 0xff, 0xff, 0xff); + cogl_material_set_color (ctx->simple_material, &white); + cogl_set_source (ctx->simple_material); +} + +void +cogl_set_source_color4ub (guint8 red, + guint8 green, + guint8 blue, + guint8 alpha) +{ + CoglColor c = { 0, }; + + cogl_color_set_from_4ub (&c, red, green, blue, alpha); + cogl_set_source_color (&c); +} + +void +cogl_set_source_color4f (float red, + float green, + float blue, + float alpha) +{ + CoglColor c = { 0, }; + + cogl_color_set_from_4f (&c, red, green, blue, alpha); + cogl_set_source_color (&c); +} +