tests: Move the create_color_texture function to test-utils

This adds a shared utility function to create a 1x1 texture with a
given color.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Neil Roberts
2012-02-10 16:57:24 +00:00
parent 39b9e717f5
commit d7164f9579
3 changed files with 30 additions and 21 deletions

View File

@ -151,4 +151,21 @@ test_utils_check_region (int x, int y,
g_free (pixels);
}
CoglTexture *
test_utils_create_color_texture (CoglContext *context,
guint32 color)
{
CoglTexture2D *tex_2d;
color = GUINT32_TO_BE (color);
tex_2d = cogl_texture_2d_new_from_data (context,
1, 1, /* width/height */
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
4, /* rowstride */
(guint8 *) &color,
NULL);
return COGL_TEXTURE (tex_2d);
}