diff options
author | Robert Bragg <robert@linux.intel.com> | 2012-04-16 21:56:40 +0100 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2012-08-06 14:27:39 +0100 |
commit | 54735dec849a0f687d71288f458ab1050b7dd806 (patch) | |
tree | 2a856c2b482f121d25b6d9393ae81b79a64b669e /cogl/cogl-bitmap-packing.h | |
parent | 09642a83b5f036756c7625ade7cf57358396baec (diff) | |
download | cogl-54735dec849a0f687d71288f458ab1050b7dd806.tar.gz |
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)
Diffstat (limited to 'cogl/cogl-bitmap-packing.h')
-rw-r--r-- | cogl/cogl-bitmap-packing.h | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/cogl/cogl-bitmap-packing.h b/cogl/cogl-bitmap-packing.h index 6c0a9858..f84af028 100644 --- a/cogl/cogl-bitmap-packing.h +++ b/cogl/cogl-bitmap-packing.h @@ -22,7 +22,7 @@ */ /* This file is included multiple times with different definitions for - the component_type type (either guint8 or guint16). The code ends + the component_type type (either uint8_t or uint16_t). The code ends up exactly the same for both but we only want to end up hitting the 16-bit path when one of the types in the conversion is > 8 bits per component. */ @@ -42,7 +42,7 @@ 511) / 1023) inline static void -G_PASTE (_cogl_unpack_a_8_, component_type) (const guint8 *src, +G_PASTE (_cogl_unpack_a_8_, component_type) (const uint8_t *src, component_type *dst, int width) { @@ -58,7 +58,7 @@ G_PASTE (_cogl_unpack_a_8_, component_type) (const guint8 *src, } inline static void -G_PASTE (_cogl_unpack_g_8_, component_type) (const guint8 *src, +G_PASTE (_cogl_unpack_g_8_, component_type) (const uint8_t *src, component_type *dst, int width) { @@ -79,7 +79,7 @@ G_PASTE (_cogl_unpack_g_8_, component_type) (const guint8 *src, } inline static void -G_PASTE (_cogl_unpack_rgb_888_, component_type) (const guint8 *src, +G_PASTE (_cogl_unpack_rgb_888_, component_type) (const uint8_t *src, component_type *dst, int width) { @@ -95,7 +95,7 @@ G_PASTE (_cogl_unpack_rgb_888_, component_type) (const guint8 *src, } inline static void -G_PASTE (_cogl_unpack_bgr_888_, component_type) (const guint8 *src, +G_PASTE (_cogl_unpack_bgr_888_, component_type) (const uint8_t *src, component_type *dst, int width) { @@ -111,7 +111,7 @@ G_PASTE (_cogl_unpack_bgr_888_, component_type) (const guint8 *src, } inline static void -G_PASTE (_cogl_unpack_bgra_8888_, component_type) (const guint8 *src, +G_PASTE (_cogl_unpack_bgra_8888_, component_type) (const uint8_t *src, component_type *dst, int width) { @@ -127,7 +127,7 @@ G_PASTE (_cogl_unpack_bgra_8888_, component_type) (const guint8 *src, } inline static void -G_PASTE (_cogl_unpack_argb_8888_, component_type) (const guint8 *src, +G_PASTE (_cogl_unpack_argb_8888_, component_type) (const uint8_t *src, component_type *dst, int width) { @@ -143,7 +143,7 @@ G_PASTE (_cogl_unpack_argb_8888_, component_type) (const guint8 *src, } inline static void -G_PASTE (_cogl_unpack_abgr_8888_, component_type) (const guint8 *src, +G_PASTE (_cogl_unpack_abgr_8888_, component_type) (const uint8_t *src, component_type *dst, int width) { @@ -159,7 +159,7 @@ G_PASTE (_cogl_unpack_abgr_8888_, component_type) (const guint8 *src, } inline static void -G_PASTE (_cogl_unpack_rgba_8888_, component_type) (const guint8 *src, +G_PASTE (_cogl_unpack_rgba_8888_, component_type) (const uint8_t *src, component_type *dst, int width) { @@ -175,13 +175,13 @@ G_PASTE (_cogl_unpack_rgba_8888_, component_type) (const guint8 *src, } inline static void -G_PASTE (_cogl_unpack_rgb_565_, component_type) (const guint8 *src, +G_PASTE (_cogl_unpack_rgb_565_, component_type) (const uint8_t *src, component_type *dst, int width) { while (width-- > 0) { - guint16 v = *(const guint16 *) src; + uint16_t v = *(const uint16_t *) src; dst[0] = UNPACK_5 (v >> 11); dst[1] = UNPACK_6 ((v >> 5) & 63); @@ -193,13 +193,13 @@ G_PASTE (_cogl_unpack_rgb_565_, component_type) (const guint8 *src, } inline static void -G_PASTE (_cogl_unpack_rgba_4444_, component_type) (const guint8 *src, +G_PASTE (_cogl_unpack_rgba_4444_, component_type) (const uint8_t *src, component_type *dst, int width) { while (width-- > 0) { - guint16 v = *(const guint16 *) src; + uint16_t v = *(const uint16_t *) src; dst[0] = UNPACK_4 (v >> 12); dst[1] = UNPACK_4 ((v >> 8) & 15); @@ -211,13 +211,13 @@ G_PASTE (_cogl_unpack_rgba_4444_, component_type) (const guint8 *src, } inline static void -G_PASTE (_cogl_unpack_rgba_5551_, component_type) (const guint8 *src, +G_PASTE (_cogl_unpack_rgba_5551_, component_type) (const uint8_t *src, component_type *dst, int width) { while (width-- > 0) { - guint16 v = *(const guint16 *) src; + uint16_t v = *(const uint16_t *) src; dst[0] = UNPACK_5 (v >> 11); dst[1] = UNPACK_5 ((v >> 6) & 31); @@ -229,13 +229,13 @@ G_PASTE (_cogl_unpack_rgba_5551_, component_type) (const guint8 *src, } inline static void -G_PASTE (_cogl_unpack_rgba_1010102_, component_type) (const guint8 *src, +G_PASTE (_cogl_unpack_rgba_1010102_, component_type) (const uint8_t *src, component_type *dst, int width) { while (width-- > 0) { - guint32 v = *(const guint32 *) src; + uint32_t v = *(const uint32_t *) src; dst[0] = UNPACK_10 (v >> 22); dst[1] = UNPACK_10 ((v >> 12) & 1023); @@ -247,13 +247,13 @@ G_PASTE (_cogl_unpack_rgba_1010102_, component_type) (const guint8 *src, } inline static void -G_PASTE (_cogl_unpack_bgra_1010102_, component_type) (const guint8 *src, +G_PASTE (_cogl_unpack_bgra_1010102_, component_type) (const uint8_t *src, component_type *dst, int width) { while (width-- > 0) { - guint32 v = *(const guint32 *) src; + uint32_t v = *(const uint32_t *) src; dst[2] = UNPACK_10 (v >> 22); dst[1] = UNPACK_10 ((v >> 12) & 1023); @@ -265,13 +265,13 @@ G_PASTE (_cogl_unpack_bgra_1010102_, component_type) (const guint8 *src, } inline static void -G_PASTE (_cogl_unpack_argb_2101010_, component_type) (const guint8 *src, +G_PASTE (_cogl_unpack_argb_2101010_, component_type) (const uint8_t *src, component_type *dst, int width) { while (width-- > 0) { - guint32 v = *(const guint32 *) src; + uint32_t v = *(const uint32_t *) src; dst[3] = UNPACK_2 (v >> 30); dst[0] = UNPACK_10 ((v >> 20) & 1023); @@ -283,13 +283,13 @@ G_PASTE (_cogl_unpack_argb_2101010_, component_type) (const guint8 *src, } inline static void -G_PASTE (_cogl_unpack_abgr_2101010_, component_type) (const guint8 *src, +G_PASTE (_cogl_unpack_abgr_2101010_, component_type) (const uint8_t *src, component_type *dst, int width) { while (width-- > 0) { - guint32 v = *(const guint32 *) src; + uint32_t v = *(const uint32_t *) src; dst[3] = UNPACK_2 (v >> 30); dst[2] = UNPACK_10 ((v >> 20) & 1023); @@ -309,7 +309,7 @@ G_PASTE (_cogl_unpack_abgr_2101010_, component_type) (const guint8 *src, inline static void G_PASTE (_cogl_unpack_, component_type) (CoglPixelFormat format, - const guint8 *src, + const uint8_t *src, component_type *dst, int width) { @@ -392,7 +392,7 @@ G_PASTE (_cogl_unpack_, component_type) (CoglPixelFormat format, inline static void G_PASTE (_cogl_pack_a_8_, component_type) (const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { while (width-- > 0) @@ -405,7 +405,7 @@ G_PASTE (_cogl_pack_a_8_, component_type) (const component_type *src, inline static void G_PASTE (_cogl_pack_g_8_, component_type) (const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { /* FIXME: I'm not sure if this is right. It looks like Nvidia and @@ -423,7 +423,7 @@ G_PASTE (_cogl_pack_g_8_, component_type) (const component_type *src, inline static void G_PASTE (_cogl_pack_rgb_888_, component_type) (const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { while (width-- > 0) @@ -438,7 +438,7 @@ G_PASTE (_cogl_pack_rgb_888_, component_type) (const component_type *src, inline static void G_PASTE (_cogl_pack_bgr_888_, component_type) (const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { while (width-- > 0) @@ -453,7 +453,7 @@ G_PASTE (_cogl_pack_bgr_888_, component_type) (const component_type *src, inline static void G_PASTE (_cogl_pack_bgra_8888_, component_type) (const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { while (width-- > 0) @@ -469,7 +469,7 @@ G_PASTE (_cogl_pack_bgra_8888_, component_type) (const component_type *src, inline static void G_PASTE (_cogl_pack_argb_8888_, component_type) (const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { while (width-- > 0) @@ -485,7 +485,7 @@ G_PASTE (_cogl_pack_argb_8888_, component_type) (const component_type *src, inline static void G_PASTE (_cogl_pack_abgr_8888_, component_type) (const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { while (width-- > 0) @@ -501,7 +501,7 @@ G_PASTE (_cogl_pack_abgr_8888_, component_type) (const component_type *src, inline static void G_PASTE (_cogl_pack_rgba_8888_, component_type) (const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { while (width-- > 0) @@ -517,12 +517,12 @@ G_PASTE (_cogl_pack_rgba_8888_, component_type) (const component_type *src, inline static void G_PASTE (_cogl_pack_rgb_565_, component_type) (const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { while (width-- > 0) { - guint16 *v = (guint16 *) dst; + uint16_t *v = (uint16_t *) dst; *v = ((PACK_5 (src[0]) << 11) | (PACK_6 (src[1]) << 5) | @@ -534,12 +534,12 @@ G_PASTE (_cogl_pack_rgb_565_, component_type) (const component_type *src, inline static void G_PASTE (_cogl_pack_rgba_4444_, component_type) (const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { while (width-- > 0) { - guint16 *v = (guint16 *) dst; + uint16_t *v = (uint16_t *) dst; *v = ((PACK_4 (src[0]) << 12) | (PACK_4 (src[1]) << 8) | @@ -552,12 +552,12 @@ G_PASTE (_cogl_pack_rgba_4444_, component_type) (const component_type *src, inline static void G_PASTE (_cogl_pack_rgba_5551_, component_type) (const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { while (width-- > 0) { - guint16 *v = (guint16 *) dst; + uint16_t *v = (uint16_t *) dst; *v = ((PACK_5 (src[0]) << 11) | (PACK_5 (src[1]) << 6) | @@ -570,12 +570,12 @@ G_PASTE (_cogl_pack_rgba_5551_, component_type) (const component_type *src, inline static void G_PASTE (_cogl_pack_rgba_1010102_, component_type) (const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { while (width-- > 0) { - guint32 *v = (guint32 *) dst; + uint32_t *v = (uint32_t *) dst; *v = ((PACK_10 (src[0]) << 22) | (PACK_10 (src[1]) << 12) | @@ -588,12 +588,12 @@ G_PASTE (_cogl_pack_rgba_1010102_, component_type) (const component_type *src, inline static void G_PASTE (_cogl_pack_bgra_1010102_, component_type) (const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { while (width-- > 0) { - guint32 *v = (guint32 *) dst; + uint32_t *v = (uint32_t *) dst; *v = ((PACK_10 (src[2]) << 22) | (PACK_10 (src[1]) << 12) | @@ -606,12 +606,12 @@ G_PASTE (_cogl_pack_bgra_1010102_, component_type) (const component_type *src, inline static void G_PASTE (_cogl_pack_argb_2101010_, component_type) (const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { while (width-- > 0) { - guint32 *v = (guint32 *) dst; + uint32_t *v = (uint32_t *) dst; *v = ((PACK_2 (src[3]) << 30) | (PACK_10 (src[0]) << 20) | @@ -624,12 +624,12 @@ G_PASTE (_cogl_pack_argb_2101010_, component_type) (const component_type *src, inline static void G_PASTE (_cogl_pack_abgr_2101010_, component_type) (const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { while (width-- > 0) { - guint32 *v = (guint32 *) dst; + uint32_t *v = (uint32_t *) dst; *v = ((PACK_2 (src[3]) << 30) | (PACK_10 (src[2]) << 20) | @@ -651,7 +651,7 @@ G_PASTE (_cogl_pack_abgr_2101010_, component_type) (const component_type *src, inline static void G_PASTE (_cogl_pack_, component_type) (CoglPixelFormat format, const component_type *src, - guint8 *dst, + uint8_t *dst, int width) { switch (format) |