2012-02-23 12:30:51 +00:00
|
|
|
#define COGL_ENABLE_EXPERIMENTAL_2_0_API
|
2011-05-05 22:34:38 +00:00
|
|
|
#include <cogl/cogl.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "test-utils.h"
|
|
|
|
|
2011-09-19 14:24:08 +00:00
|
|
|
#define FB_WIDTH 512
|
|
|
|
#define FB_HEIGHT 512
|
2011-05-05 22:34:38 +00:00
|
|
|
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
static CoglBool cogl_test_is_verbose;
|
2012-02-23 12:30:51 +00:00
|
|
|
|
2012-03-16 19:54:13 +00:00
|
|
|
CoglContext *ctx;
|
|
|
|
CoglFramebuffer *fb;
|
|
|
|
|
2011-05-05 22:34:38 +00:00
|
|
|
void
|
2012-03-16 19:54:13 +00:00
|
|
|
test_utils_init (TestFlags flags)
|
2011-05-05 22:34:38 +00:00
|
|
|
{
|
|
|
|
static int counter = 0;
|
2012-08-31 18:28:27 +00:00
|
|
|
CoglError *error = NULL;
|
2011-05-05 22:34:38 +00:00
|
|
|
CoglOnscreen *onscreen = NULL;
|
2012-02-23 12:30:51 +00:00
|
|
|
CoglDisplay *display;
|
|
|
|
CoglRenderer *renderer;
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
CoglBool missing_requirement = FALSE;
|
2011-05-05 22:34:38 +00:00
|
|
|
|
|
|
|
if (counter != 0)
|
|
|
|
g_critical ("We don't support running more than one test at a time\n"
|
|
|
|
"in a single test run due to the state leakage that can\n"
|
|
|
|
"cause subsequent tests to fail.\n"
|
|
|
|
"\n"
|
|
|
|
"If you want to run all the tests you should run\n"
|
|
|
|
"$ make test-report");
|
|
|
|
counter++;
|
|
|
|
|
2012-02-23 12:30:51 +00:00
|
|
|
if (g_getenv ("COGL_TEST_VERBOSE") || g_getenv ("V"))
|
|
|
|
cogl_test_is_verbose = TRUE;
|
|
|
|
|
|
|
|
if (g_getenv ("G_DEBUG"))
|
|
|
|
{
|
|
|
|
char *debug = g_strconcat (g_getenv ("G_DEBUG"), ",fatal-warnings", NULL);
|
|
|
|
g_setenv ("G_DEBUG", debug, TRUE);
|
|
|
|
g_free (debug);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_setenv ("G_DEBUG", "fatal-warnings", TRUE);
|
|
|
|
|
2011-09-19 12:40:28 +00:00
|
|
|
g_setenv ("COGL_X11_SYNC", "1", 0);
|
2011-05-05 22:34:38 +00:00
|
|
|
|
2012-03-16 19:54:13 +00:00
|
|
|
ctx = cogl_context_new (NULL, &error);
|
|
|
|
if (!ctx)
|
2011-05-05 22:34:38 +00:00
|
|
|
g_critical ("Failed to create a CoglContext: %s", error->message);
|
|
|
|
|
2012-03-16 19:54:13 +00:00
|
|
|
display = cogl_context_get_display (ctx);
|
2012-02-23 12:30:51 +00:00
|
|
|
renderer = cogl_display_get_renderer (display);
|
|
|
|
|
2012-03-06 23:41:49 +00:00
|
|
|
if (flags & TEST_REQUIREMENT_GL &&
|
2012-09-26 19:32:36 +00:00
|
|
|
cogl_renderer_get_driver (renderer) != COGL_DRIVER_GL &&
|
|
|
|
cogl_renderer_get_driver (renderer) != COGL_DRIVER_GL3)
|
2012-02-23 12:30:51 +00:00
|
|
|
{
|
|
|
|
missing_requirement = TRUE;
|
|
|
|
}
|
|
|
|
|
2012-03-06 23:41:49 +00:00
|
|
|
if (flags & TEST_REQUIREMENT_NPOT &&
|
2012-03-16 19:54:13 +00:00
|
|
|
!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT))
|
2012-02-23 12:30:51 +00:00
|
|
|
{
|
|
|
|
missing_requirement = TRUE;
|
|
|
|
}
|
|
|
|
|
2012-03-06 23:41:49 +00:00
|
|
|
if (flags & TEST_REQUIREMENT_TEXTURE_3D &&
|
2012-03-16 19:54:13 +00:00
|
|
|
!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_3D))
|
2012-02-23 12:30:51 +00:00
|
|
|
{
|
|
|
|
missing_requirement = TRUE;
|
|
|
|
}
|
|
|
|
|
2012-03-06 23:36:45 +00:00
|
|
|
if (flags & TEST_REQUIREMENT_POINT_SPRITE &&
|
2012-03-16 19:54:13 +00:00
|
|
|
!cogl_has_feature (ctx, COGL_FEATURE_ID_POINT_SPRITE))
|
2012-03-06 23:36:45 +00:00
|
|
|
{
|
|
|
|
missing_requirement = TRUE;
|
|
|
|
}
|
|
|
|
|
2012-04-26 11:18:56 +00:00
|
|
|
if (flags & TEST_REQUIREMENT_GLES2_CONTEXT &&
|
|
|
|
!cogl_has_feature (ctx, COGL_FEATURE_ID_GLES2_CONTEXT))
|
|
|
|
{
|
|
|
|
missing_requirement = TRUE;
|
|
|
|
}
|
|
|
|
|
2012-03-06 23:41:49 +00:00
|
|
|
if (flags & TEST_KNOWN_FAILURE)
|
|
|
|
{
|
|
|
|
missing_requirement = TRUE;
|
|
|
|
}
|
|
|
|
|
2011-05-05 22:34:38 +00:00
|
|
|
if (getenv ("COGL_TEST_ONSCREEN"))
|
|
|
|
{
|
2012-03-16 19:54:13 +00:00
|
|
|
onscreen = cogl_onscreen_new (ctx, 640, 480);
|
|
|
|
fb = COGL_FRAMEBUFFER (onscreen);
|
2011-05-05 22:34:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-16 13:14:10 +00:00
|
|
|
CoglOffscreen *offscreen;
|
|
|
|
CoglTexture2D *tex = cogl_texture_2d_new_with_size (ctx,
|
|
|
|
FB_WIDTH, FB_HEIGHT,
|
|
|
|
COGL_PIXEL_FORMAT_ANY,
|
|
|
|
&error);
|
2011-05-05 22:34:38 +00:00
|
|
|
if (!tex)
|
|
|
|
g_critical ("Failed to allocate texture: %s", error->message);
|
|
|
|
|
2012-04-16 13:14:10 +00:00
|
|
|
offscreen = cogl_offscreen_new_to_texture (COGL_TEXTURE (tex));
|
2012-03-16 19:54:13 +00:00
|
|
|
fb = COGL_FRAMEBUFFER (offscreen);
|
2011-05-05 22:34:38 +00:00
|
|
|
}
|
|
|
|
|
2012-03-16 19:54:13 +00:00
|
|
|
if (!cogl_framebuffer_allocate (fb, &error))
|
2011-05-05 22:34:38 +00:00
|
|
|
g_critical ("Failed to allocate framebuffer: %s", error->message);
|
|
|
|
|
|
|
|
if (onscreen)
|
|
|
|
cogl_onscreen_show (onscreen);
|
|
|
|
|
2012-03-16 19:54:13 +00:00
|
|
|
cogl_framebuffer_clear4f (fb,
|
2011-05-05 22:34:38 +00:00
|
|
|
COGL_BUFFER_BIT_COLOR |
|
|
|
|
COGL_BUFFER_BIT_DEPTH |
|
|
|
|
COGL_BUFFER_BIT_STENCIL,
|
|
|
|
0, 0, 0, 1);
|
|
|
|
|
2012-02-23 12:30:51 +00:00
|
|
|
if (missing_requirement)
|
|
|
|
g_print ("WARNING: Missing required feature[s] for this test\n");
|
2011-05-05 22:34:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-03-16 19:54:13 +00:00
|
|
|
test_utils_fini (void)
|
2011-05-05 22:34:38 +00:00
|
|
|
{
|
2012-03-16 19:54:13 +00:00
|
|
|
if (fb)
|
|
|
|
cogl_object_unref (fb);
|
2011-05-05 22:34:38 +00:00
|
|
|
|
2012-03-16 19:54:13 +00:00
|
|
|
if (ctx)
|
|
|
|
cogl_object_unref (ctx);
|
2011-05-05 22:34:38 +00:00
|
|
|
}
|
2011-10-26 13:15:14 +00:00
|
|
|
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
static CoglBool
|
2011-12-07 12:38:38 +00:00
|
|
|
compare_component (int a, int b)
|
|
|
|
{
|
|
|
|
return ABS (a - b) <= 1;
|
|
|
|
}
|
|
|
|
|
2012-01-28 13:40:22 +00:00
|
|
|
void
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
test_utils_compare_pixel (const uint8_t *screen_pixel, uint32_t expected_pixel)
|
2011-12-07 12:38:38 +00:00
|
|
|
{
|
|
|
|
/* Compare each component with a small fuzz factor */
|
|
|
|
if (!compare_component (screen_pixel[0], expected_pixel >> 24) ||
|
|
|
|
!compare_component (screen_pixel[1], (expected_pixel >> 16) & 0xff) ||
|
|
|
|
!compare_component (screen_pixel[2], (expected_pixel >> 8) & 0xff))
|
|
|
|
{
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
uint32_t screen_pixel_num = GUINT32_FROM_BE (*(uint32_t *) screen_pixel);
|
2011-12-07 12:38:38 +00:00
|
|
|
char *screen_pixel_string =
|
|
|
|
g_strdup_printf ("#%06x", screen_pixel_num >> 8);
|
|
|
|
char *expected_pixel_string =
|
|
|
|
g_strdup_printf ("#%06x", expected_pixel >> 8);
|
|
|
|
|
|
|
|
g_assert_cmpstr (screen_pixel_string, ==, expected_pixel_string);
|
|
|
|
|
|
|
|
g_free (screen_pixel_string);
|
|
|
|
g_free (expected_pixel_string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-26 13:15:14 +00:00
|
|
|
void
|
2012-03-16 19:54:13 +00:00
|
|
|
test_utils_check_pixel (CoglFramebuffer *fb,
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
int x, int y, uint32_t expected_pixel)
|
2011-10-26 13:15:14 +00:00
|
|
|
{
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
uint8_t pixel[4];
|
2011-10-26 13:15:14 +00:00
|
|
|
|
2012-03-16 19:54:13 +00:00
|
|
|
cogl_framebuffer_read_pixels (fb,
|
|
|
|
x, y, 1, 1,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
|
|
|
pixel);
|
2011-10-26 13:15:14 +00:00
|
|
|
|
2012-01-28 13:40:22 +00:00
|
|
|
test_utils_compare_pixel (pixel, expected_pixel);
|
2011-10-26 13:15:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-03-16 19:54:13 +00:00
|
|
|
test_utils_check_pixel_rgb (CoglFramebuffer *fb,
|
|
|
|
int x, int y, int r, int g, int b)
|
2011-10-26 13:15:14 +00:00
|
|
|
{
|
2012-03-16 19:54:13 +00:00
|
|
|
test_utils_check_pixel (fb, x, y, (r << 24) | (g << 16) | (b << 8));
|
2011-10-26 13:15:14 +00:00
|
|
|
}
|
2011-10-31 14:55:20 +00:00
|
|
|
|
|
|
|
void
|
2012-03-16 19:54:13 +00:00
|
|
|
test_utils_check_region (CoglFramebuffer *fb,
|
|
|
|
int x, int y,
|
2011-10-31 14:55:20 +00:00
|
|
|
int width, int height,
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
uint32_t expected_rgba)
|
2011-10-31 14:55:20 +00:00
|
|
|
{
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
uint8_t *pixels, *p;
|
2011-10-31 14:55:20 +00:00
|
|
|
|
|
|
|
pixels = p = g_malloc (width * height * 4);
|
2012-03-16 19:54:13 +00:00
|
|
|
cogl_framebuffer_read_pixels (fb,
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888,
|
|
|
|
p);
|
2011-10-31 14:55:20 +00:00
|
|
|
|
|
|
|
/* Check whether the center of each division is the right color */
|
|
|
|
for (y = 0; y < height; y++)
|
|
|
|
for (x = 0; x < width; x++)
|
|
|
|
{
|
2012-01-28 13:40:22 +00:00
|
|
|
test_utils_compare_pixel (p, expected_rgba);
|
2011-10-31 14:55:20 +00:00
|
|
|
p += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (pixels);
|
|
|
|
}
|
|
|
|
|
2012-02-10 16:57:24 +00:00
|
|
|
CoglTexture *
|
|
|
|
test_utils_create_color_texture (CoglContext *context,
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
uint32_t color)
|
2012-02-10 16:57:24 +00:00
|
|
|
{
|
|
|
|
CoglTexture2D *tex_2d;
|
|
|
|
|
|
|
|
color = GUINT32_TO_BE (color);
|
2011-10-31 14:55:20 +00:00
|
|
|
|
2012-02-10 16:57:24 +00:00
|
|
|
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 */
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
(uint8_t *) &color,
|
2012-02-10 16:57:24 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return COGL_TEXTURE (tex_2d);
|
|
|
|
}
|
2012-02-23 12:30:51 +00:00
|
|
|
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
CoglBool
|
2012-02-23 12:30:51 +00:00
|
|
|
cogl_test_verbose (void)
|
|
|
|
{
|
|
|
|
return cogl_test_is_verbose;
|
|
|
|
}
|