cogl: move cogl_set_source* funcs into cogl.c

Previously cogl_set_source and cogl_set_source_texture were in
cogl-material.c and the cogl_set_source_color* funcs were in
cogl-color.c. Originally this was because cogl.c was duplicated between
the GL and GLES backends and we didn't want to add to the amount of
duplicated code, but these files have since been consolidated into one
cogl.c.
This commit is contained in:
Robert Bragg 2010-03-19 09:55:30 +00:00
parent a678e9f627
commit 6f6ab86929
3 changed files with 59 additions and 61 deletions

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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);
}