2016-06-16 19:04:40 +00:00
|
|
|
#include <cogl/cogl.h>
|
2012-02-29 21:43:01 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2019-01-20 10:41:48 +00:00
|
|
|
#include "test-declarations.h"
|
2012-02-29 21:43:01 +00:00
|
|
|
#include "test-utils.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This tests reading back an RGBA texture in all of the available
|
|
|
|
* pixel formats
|
|
|
|
*/
|
|
|
|
|
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 const uint8_t tex_data[4] = { 0x12, 0x34, 0x56, 0x78 };
|
2012-02-29 21:43:01 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
test_read_byte (CoglTexture2D *tex_2d,
|
|
|
|
CoglPixelFormat format,
|
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 expected_byte)
|
2012-02-29 21:43:01 +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 received_byte;
|
2012-02-29 21:43:01 +00:00
|
|
|
|
2013-10-09 12:31:12 +00:00
|
|
|
cogl_texture_get_data (tex_2d,
|
2012-02-29 21:43:01 +00:00
|
|
|
format,
|
|
|
|
1, /* rowstride */
|
|
|
|
&received_byte);
|
|
|
|
|
|
|
|
g_assert_cmpint (expected_byte, ==, received_byte);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_read_short (CoglTexture2D *tex_2d,
|
|
|
|
CoglPixelFormat format,
|
|
|
|
...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
int bits;
|
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
|
|
|
uint16_t received_value;
|
|
|
|
uint16_t expected_value = 0;
|
2012-02-29 21:43:01 +00:00
|
|
|
char *received_value_str;
|
|
|
|
char *expected_value_str;
|
|
|
|
int bits_sum = 0;
|
|
|
|
|
2013-10-09 12:31:12 +00:00
|
|
|
cogl_texture_get_data (tex_2d,
|
2012-02-29 21:43:01 +00:00
|
|
|
format,
|
|
|
|
2, /* 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 *) &received_value);
|
2012-02-29 21:43:01 +00:00
|
|
|
|
|
|
|
va_start (ap, format);
|
|
|
|
|
|
|
|
/* Convert the va args into a single 16-bit expected value */
|
|
|
|
while ((bits = va_arg (ap, int)) != -1)
|
|
|
|
{
|
|
|
|
int value = (va_arg (ap, int) * ((1 << bits) - 1) + 128) / 255;
|
|
|
|
|
|
|
|
bits_sum += bits;
|
|
|
|
|
|
|
|
expected_value |= value << (16 - bits_sum);
|
|
|
|
}
|
|
|
|
|
|
|
|
va_end (ap);
|
|
|
|
|
|
|
|
received_value_str = g_strdup_printf ("0x%04x", received_value);
|
|
|
|
expected_value_str = g_strdup_printf ("0x%04x", expected_value);
|
|
|
|
g_assert_cmpstr (received_value_str, ==, expected_value_str);
|
|
|
|
g_free (received_value_str);
|
|
|
|
g_free (expected_value_str);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_read_888 (CoglTexture2D *tex_2d,
|
|
|
|
CoglPixelFormat format,
|
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_pixel)
|
2012-02-29 21:43:01 +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];
|
2012-02-29 21:43:01 +00:00
|
|
|
|
2013-10-09 12:31:12 +00:00
|
|
|
cogl_texture_get_data (tex_2d,
|
2012-02-29 21:43:01 +00:00
|
|
|
format,
|
|
|
|
4, /* rowstride */
|
|
|
|
pixel);
|
|
|
|
|
|
|
|
test_utils_compare_pixel (pixel, expected_pixel);
|
|
|
|
}
|
|
|
|
|
2014-01-14 15:52:45 +00:00
|
|
|
static void
|
|
|
|
test_read_88 (CoglTexture2D *tex_2d,
|
|
|
|
CoglPixelFormat format,
|
|
|
|
uint32_t expected_pixel)
|
|
|
|
{
|
|
|
|
uint8_t pixel[4];
|
|
|
|
|
|
|
|
pixel[2] = 0x00;
|
|
|
|
|
|
|
|
cogl_texture_get_data (tex_2d,
|
|
|
|
format,
|
|
|
|
2, /* rowstride */
|
|
|
|
pixel);
|
|
|
|
|
|
|
|
test_utils_compare_pixel (pixel, expected_pixel);
|
|
|
|
}
|
|
|
|
|
2012-02-29 21:43:01 +00:00
|
|
|
static void
|
|
|
|
test_read_8888 (CoglTexture2D *tex_2d,
|
|
|
|
CoglPixelFormat format,
|
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_pixel)
|
2012-02-29 21:43:01 +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
|
|
|
uint32_t received_pixel;
|
2012-02-29 21:43:01 +00:00
|
|
|
char *received_value_str;
|
|
|
|
char *expected_value_str;
|
|
|
|
|
2013-10-09 12:31:12 +00:00
|
|
|
cogl_texture_get_data (tex_2d,
|
2012-02-29 21:43:01 +00:00
|
|
|
format,
|
|
|
|
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 *) &received_pixel);
|
2012-02-29 21:43:01 +00:00
|
|
|
|
|
|
|
received_pixel = GUINT32_FROM_BE (received_pixel);
|
|
|
|
|
|
|
|
received_value_str = g_strdup_printf ("0x%08x", received_pixel);
|
|
|
|
expected_value_str = g_strdup_printf ("0x%08x", expected_pixel);
|
|
|
|
g_assert_cmpstr (received_value_str, ==, expected_value_str);
|
|
|
|
g_free (received_value_str);
|
|
|
|
g_free (expected_value_str);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_read_int (CoglTexture2D *tex_2d,
|
|
|
|
CoglPixelFormat format,
|
|
|
|
...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
int bits;
|
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 received_value;
|
|
|
|
uint32_t expected_value = 0;
|
2012-02-29 21:43:01 +00:00
|
|
|
char *received_value_str;
|
|
|
|
char *expected_value_str;
|
|
|
|
int bits_sum = 0;
|
|
|
|
|
2013-10-09 12:31:12 +00:00
|
|
|
cogl_texture_get_data (tex_2d,
|
2012-02-29 21:43:01 +00:00
|
|
|
format,
|
|
|
|
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 *) &received_value);
|
2012-02-29 21:43:01 +00:00
|
|
|
|
|
|
|
va_start (ap, format);
|
|
|
|
|
|
|
|
/* Convert the va args into a single 32-bit expected value */
|
|
|
|
while ((bits = va_arg (ap, int)) != -1)
|
|
|
|
{
|
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 value = (va_arg (ap, int) * ((1 << bits) - 1) + 128) / 255;
|
2012-02-29 21:43:01 +00:00
|
|
|
|
|
|
|
bits_sum += bits;
|
|
|
|
|
|
|
|
expected_value |= value << (32 - bits_sum);
|
|
|
|
}
|
|
|
|
|
|
|
|
va_end (ap);
|
|
|
|
|
|
|
|
received_value_str = g_strdup_printf ("0x%08x", received_value);
|
|
|
|
expected_value_str = g_strdup_printf ("0x%08x", expected_value);
|
|
|
|
g_assert_cmpstr (received_value_str, ==, expected_value_str);
|
|
|
|
g_free (received_value_str);
|
|
|
|
g_free (expected_value_str);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-03-16 19:54:13 +00:00
|
|
|
test_read_texture_formats (void)
|
2012-02-29 21:43:01 +00:00
|
|
|
{
|
|
|
|
CoglTexture2D *tex_2d;
|
|
|
|
|
2013-01-18 17:57:06 +00:00
|
|
|
tex_2d = cogl_texture_2d_new_from_data (test_ctx,
|
2012-02-29 21:43:01 +00:00
|
|
|
1, 1, /* width / height */
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
|
|
|
4, /* rowstride */
|
|
|
|
tex_data,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
test_read_byte (tex_2d, COGL_PIXEL_FORMAT_A_8, 0x78);
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* I'm not sure what's the right value to put here because Nvidia
|
|
|
|
and Mesa seem to behave differently so one of them must be
|
|
|
|
wrong. */
|
|
|
|
test_read_byte (tex_2d, COGL_PIXEL_FORMAT_G_8, 0x9c);
|
|
|
|
#endif
|
|
|
|
|
2014-01-14 15:52:45 +00:00
|
|
|
/* We should always be able to read into an RG buffer regardless of
|
|
|
|
* whether RG textures are supported because Cogl will do the
|
|
|
|
* conversion for us */
|
|
|
|
test_read_88 (tex_2d, COGL_PIXEL_FORMAT_RG_88, 0x123400ff);
|
|
|
|
|
2012-02-29 21:43:01 +00:00
|
|
|
test_read_short (tex_2d, COGL_PIXEL_FORMAT_RGB_565,
|
|
|
|
5, 0x12, 6, 0x34, 5, 0x56,
|
|
|
|
-1);
|
|
|
|
test_read_short (tex_2d, COGL_PIXEL_FORMAT_RGBA_4444_PRE,
|
|
|
|
4, 0x12, 4, 0x34, 4, 0x56, 4, 0x78,
|
|
|
|
-1);
|
|
|
|
test_read_short (tex_2d, COGL_PIXEL_FORMAT_RGBA_5551_PRE,
|
|
|
|
5, 0x12, 5, 0x34, 5, 0x56, 1, 0x78,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
test_read_888 (tex_2d, COGL_PIXEL_FORMAT_RGB_888, 0x123456ff);
|
|
|
|
test_read_888 (tex_2d, COGL_PIXEL_FORMAT_BGR_888, 0x563412ff);
|
|
|
|
|
|
|
|
test_read_8888 (tex_2d, COGL_PIXEL_FORMAT_RGBA_8888_PRE, 0x12345678);
|
|
|
|
test_read_8888 (tex_2d, COGL_PIXEL_FORMAT_BGRA_8888_PRE, 0x56341278);
|
|
|
|
test_read_8888 (tex_2d, COGL_PIXEL_FORMAT_ARGB_8888_PRE, 0x78123456);
|
|
|
|
test_read_8888 (tex_2d, COGL_PIXEL_FORMAT_ABGR_8888_PRE, 0x78563412);
|
|
|
|
|
|
|
|
test_read_int (tex_2d, COGL_PIXEL_FORMAT_RGBA_1010102_PRE,
|
|
|
|
10, 0x12, 10, 0x34, 10, 0x56, 2, 0x78,
|
|
|
|
-1);
|
|
|
|
test_read_int (tex_2d, COGL_PIXEL_FORMAT_BGRA_1010102_PRE,
|
|
|
|
10, 0x56, 10, 0x34, 10, 0x12, 2, 0x78,
|
|
|
|
-1);
|
|
|
|
test_read_int (tex_2d, COGL_PIXEL_FORMAT_ARGB_2101010_PRE,
|
|
|
|
2, 0x78, 10, 0x12, 10, 0x34, 10, 0x56,
|
|
|
|
-1);
|
|
|
|
test_read_int (tex_2d, COGL_PIXEL_FORMAT_ABGR_2101010_PRE,
|
|
|
|
2, 0x78, 10, 0x56, 10, 0x34, 10, 0x12,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
cogl_object_unref (tex_2d);
|
|
|
|
|
2012-09-17 01:18:10 +00:00
|
|
|
if (cogl_test_verbose ())
|
2012-02-29 21:43:01 +00:00
|
|
|
g_print ("OK\n");
|
|
|
|
}
|