summaryrefslogtreecommitdiff
path: root/cogl/cogl-bitmap-packing.h
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2013-01-18 18:14:42 +0000
committerRobert Bragg <robert@linux.intel.com>2013-01-22 18:00:11 +0000
commit51f3e28c1f89aa1d4aeea34f2d442a7bdcfcd9e0 (patch)
tree2c3b43c34e73df585a395966c476dd9014bcd383 /cogl/cogl-bitmap-packing.h
parent50005a93647173222c2dfe3ca81812c3794f06be (diff)
downloadcogl-51f3e28c1f89aa1d4aeea34f2d442a7bdcfcd9e0.tar.gz
bitmap: Don't try to token paste the typenames from stdint.h
Previously the functions for packing and unpacking pixels where generated by token pasting together a function name along with its type, like the following: _cogl_pack_ ## uint8_t Then later in cogl-bitmap-conversion.c it would directly refer to the function names without token pasting. This wouldn't work however if the system headers define the stdint types using #defines instead of typedefs because in that case the function name generated using token pasting would get the expanded type name but the reference that doesn't use token pasting wouldn't. This patch adds an extra macro passed to the cogl-bitmap-packing.h header which just has the type size. That way the function can be defined like this instead: _cogl_pack_ ## 8 That should prevent it from hitting problems with #defined types. https://bugzilla.gnome.org/show_bug.cgi?id=691945 Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit d6b5d7085b004ebd48c1543b820331802395ee63)
Diffstat (limited to 'cogl/cogl-bitmap-packing.h')
-rw-r--r--cogl/cogl-bitmap-packing.h124
1 files changed, 62 insertions, 62 deletions
diff --git a/cogl/cogl-bitmap-packing.h b/cogl/cogl-bitmap-packing.h
index d2fc4fb1..e631c17f 100644
--- a/cogl/cogl-bitmap-packing.h
+++ b/cogl/cogl-bitmap-packing.h
@@ -42,7 +42,7 @@
511) / 1023)
inline static void
-G_PASTE (_cogl_unpack_a_8_, component_type) (const uint8_t *src,
+G_PASTE (_cogl_unpack_a_8_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
@@ -58,7 +58,7 @@ G_PASTE (_cogl_unpack_a_8_, component_type) (const uint8_t *src,
}
inline static void
-G_PASTE (_cogl_unpack_g_8_, component_type) (const uint8_t *src,
+G_PASTE (_cogl_unpack_g_8_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
@@ -79,7 +79,7 @@ G_PASTE (_cogl_unpack_g_8_, component_type) (const uint8_t *src,
}
inline static void
-G_PASTE (_cogl_unpack_rgb_888_, component_type) (const uint8_t *src,
+G_PASTE (_cogl_unpack_rgb_888_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
@@ -95,7 +95,7 @@ G_PASTE (_cogl_unpack_rgb_888_, component_type) (const uint8_t *src,
}
inline static void
-G_PASTE (_cogl_unpack_bgr_888_, component_type) (const uint8_t *src,
+G_PASTE (_cogl_unpack_bgr_888_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
@@ -111,7 +111,7 @@ G_PASTE (_cogl_unpack_bgr_888_, component_type) (const uint8_t *src,
}
inline static void
-G_PASTE (_cogl_unpack_bgra_8888_, component_type) (const uint8_t *src,
+G_PASTE (_cogl_unpack_bgra_8888_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
@@ -127,7 +127,7 @@ G_PASTE (_cogl_unpack_bgra_8888_, component_type) (const uint8_t *src,
}
inline static void
-G_PASTE (_cogl_unpack_argb_8888_, component_type) (const uint8_t *src,
+G_PASTE (_cogl_unpack_argb_8888_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
@@ -143,7 +143,7 @@ G_PASTE (_cogl_unpack_argb_8888_, component_type) (const uint8_t *src,
}
inline static void
-G_PASTE (_cogl_unpack_abgr_8888_, component_type) (const uint8_t *src,
+G_PASTE (_cogl_unpack_abgr_8888_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
@@ -159,7 +159,7 @@ G_PASTE (_cogl_unpack_abgr_8888_, component_type) (const uint8_t *src,
}
inline static void
-G_PASTE (_cogl_unpack_rgba_8888_, component_type) (const uint8_t *src,
+G_PASTE (_cogl_unpack_rgba_8888_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
@@ -175,7 +175,7 @@ G_PASTE (_cogl_unpack_rgba_8888_, component_type) (const uint8_t *src,
}
inline static void
-G_PASTE (_cogl_unpack_rgb_565_, component_type) (const uint8_t *src,
+G_PASTE (_cogl_unpack_rgb_565_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
@@ -193,7 +193,7 @@ G_PASTE (_cogl_unpack_rgb_565_, component_type) (const uint8_t *src,
}
inline static void
-G_PASTE (_cogl_unpack_rgba_4444_, component_type) (const uint8_t *src,
+G_PASTE (_cogl_unpack_rgba_4444_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
@@ -211,7 +211,7 @@ G_PASTE (_cogl_unpack_rgba_4444_, component_type) (const uint8_t *src,
}
inline static void
-G_PASTE (_cogl_unpack_rgba_5551_, component_type) (const uint8_t *src,
+G_PASTE (_cogl_unpack_rgba_5551_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
@@ -229,7 +229,7 @@ G_PASTE (_cogl_unpack_rgba_5551_, component_type) (const uint8_t *src,
}
inline static void
-G_PASTE (_cogl_unpack_rgba_1010102_, component_type) (const uint8_t *src,
+G_PASTE (_cogl_unpack_rgba_1010102_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
@@ -247,7 +247,7 @@ G_PASTE (_cogl_unpack_rgba_1010102_, component_type) (const uint8_t *src,
}
inline static void
-G_PASTE (_cogl_unpack_bgra_1010102_, component_type) (const uint8_t *src,
+G_PASTE (_cogl_unpack_bgra_1010102_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
@@ -265,7 +265,7 @@ G_PASTE (_cogl_unpack_bgra_1010102_, component_type) (const uint8_t *src,
}
inline static void
-G_PASTE (_cogl_unpack_argb_2101010_, component_type) (const uint8_t *src,
+G_PASTE (_cogl_unpack_argb_2101010_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
@@ -283,7 +283,7 @@ G_PASTE (_cogl_unpack_argb_2101010_, component_type) (const uint8_t *src,
}
inline static void
-G_PASTE (_cogl_unpack_abgr_2101010_, component_type) (const uint8_t *src,
+G_PASTE (_cogl_unpack_abgr_2101010_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
@@ -308,7 +308,7 @@ G_PASTE (_cogl_unpack_abgr_2101010_, component_type) (const uint8_t *src,
#undef UNPACK_10
inline static void
-G_PASTE (_cogl_unpack_, component_type) (CoglPixelFormat format,
+G_PASTE (_cogl_unpack_, component_size) (CoglPixelFormat format,
const uint8_t *src,
component_type *dst,
int width)
@@ -316,59 +316,59 @@ G_PASTE (_cogl_unpack_, component_type) (CoglPixelFormat format,
switch (format)
{
case COGL_PIXEL_FORMAT_A_8:
- G_PASTE (_cogl_unpack_a_8_, component_type) (src, dst, width);
+ G_PASTE (_cogl_unpack_a_8_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_G_8:
- G_PASTE (_cogl_unpack_g_8_, component_type) (src, dst, width);
+ G_PASTE (_cogl_unpack_g_8_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGB_888:
- G_PASTE (_cogl_unpack_rgb_888_, component_type) (src, dst, width);
+ G_PASTE (_cogl_unpack_rgb_888_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_BGR_888:
- G_PASTE (_cogl_unpack_bgr_888_, component_type) (src, dst, width);
+ G_PASTE (_cogl_unpack_bgr_888_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGBA_8888:
case COGL_PIXEL_FORMAT_RGBA_8888_PRE:
- G_PASTE (_cogl_unpack_rgba_8888_, component_type) (src, dst, width);
+ G_PASTE (_cogl_unpack_rgba_8888_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_BGRA_8888:
case COGL_PIXEL_FORMAT_BGRA_8888_PRE:
- G_PASTE (_cogl_unpack_bgra_8888_, component_type) (src, dst, width);
+ G_PASTE (_cogl_unpack_bgra_8888_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_ARGB_8888:
case COGL_PIXEL_FORMAT_ARGB_8888_PRE:
- G_PASTE (_cogl_unpack_argb_8888_, component_type) (src, dst, width);
+ G_PASTE (_cogl_unpack_argb_8888_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_ABGR_8888:
case COGL_PIXEL_FORMAT_ABGR_8888_PRE:
- G_PASTE (_cogl_unpack_abgr_8888_, component_type) (src, dst, width);
+ G_PASTE (_cogl_unpack_abgr_8888_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGB_565:
- G_PASTE (_cogl_unpack_rgb_565_, component_type) (src, dst, width);
+ G_PASTE (_cogl_unpack_rgb_565_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGBA_4444:
case COGL_PIXEL_FORMAT_RGBA_4444_PRE:
- G_PASTE (_cogl_unpack_rgba_4444_, component_type) (src, dst, width);
+ G_PASTE (_cogl_unpack_rgba_4444_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGBA_5551:
case COGL_PIXEL_FORMAT_RGBA_5551_PRE:
- G_PASTE (_cogl_unpack_rgba_5551_, component_type) (src, dst, width);
+ G_PASTE (_cogl_unpack_rgba_5551_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGBA_1010102:
case COGL_PIXEL_FORMAT_RGBA_1010102_PRE:
- G_PASTE (_cogl_unpack_rgba_1010102_, component_type) (src, dst, width);
+ G_PASTE (_cogl_unpack_rgba_1010102_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_BGRA_1010102:
case COGL_PIXEL_FORMAT_BGRA_1010102_PRE:
- G_PASTE (_cogl_unpack_bgra_1010102_, component_type) (src, dst, width);
+ G_PASTE (_cogl_unpack_bgra_1010102_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_ARGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010_PRE:
- G_PASTE (_cogl_unpack_argb_2101010_, component_type) (src, dst, width);
+ G_PASTE (_cogl_unpack_argb_2101010_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_ABGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
- G_PASTE (_cogl_unpack_abgr_2101010_, component_type) (src, dst, width);
+ G_PASTE (_cogl_unpack_abgr_2101010_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_DEPTH_16:
case COGL_PIXEL_FORMAT_DEPTH_32:
@@ -394,7 +394,7 @@ G_PASTE (_cogl_unpack_, component_type) (CoglPixelFormat format,
#define PACK_10(b) PACK_SIZE (b, 1023)
inline static void
-G_PASTE (_cogl_pack_a_8_, component_type) (const component_type *src,
+G_PASTE (_cogl_pack_a_8_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
@@ -407,7 +407,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,
+G_PASTE (_cogl_pack_g_8_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
@@ -425,7 +425,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,
+G_PASTE (_cogl_pack_rgb_888_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
@@ -440,7 +440,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,
+G_PASTE (_cogl_pack_bgr_888_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
@@ -455,7 +455,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,
+G_PASTE (_cogl_pack_bgra_8888_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
@@ -471,7 +471,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,
+G_PASTE (_cogl_pack_argb_8888_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
@@ -487,7 +487,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,
+G_PASTE (_cogl_pack_abgr_8888_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
@@ -503,7 +503,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,
+G_PASTE (_cogl_pack_rgba_8888_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
@@ -519,7 +519,7 @@ 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,
+G_PASTE (_cogl_pack_rgb_565_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
@@ -536,7 +536,7 @@ 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,
+G_PASTE (_cogl_pack_rgba_4444_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
@@ -554,7 +554,7 @@ 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,
+G_PASTE (_cogl_pack_rgba_5551_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
@@ -572,7 +572,7 @@ 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,
+G_PASTE (_cogl_pack_rgba_1010102_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
@@ -590,7 +590,7 @@ 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,
+G_PASTE (_cogl_pack_bgra_1010102_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
@@ -608,7 +608,7 @@ 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,
+G_PASTE (_cogl_pack_argb_2101010_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
@@ -626,7 +626,7 @@ 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,
+G_PASTE (_cogl_pack_abgr_2101010_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
@@ -652,7 +652,7 @@ G_PASTE (_cogl_pack_abgr_2101010_, component_type) (const component_type *src,
#undef PACK_10
inline static void
-G_PASTE (_cogl_pack_, component_type) (CoglPixelFormat format,
+G_PASTE (_cogl_pack_, component_size) (CoglPixelFormat format,
const component_type *src,
uint8_t *dst,
int width)
@@ -660,59 +660,59 @@ G_PASTE (_cogl_pack_, component_type) (CoglPixelFormat format,
switch (format)
{
case COGL_PIXEL_FORMAT_A_8:
- G_PASTE (_cogl_pack_a_8_, component_type) (src, dst, width);
+ G_PASTE (_cogl_pack_a_8_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_G_8:
- G_PASTE (_cogl_pack_g_8_, component_type) (src, dst, width);
+ G_PASTE (_cogl_pack_g_8_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGB_888:
- G_PASTE (_cogl_pack_rgb_888_, component_type) (src, dst, width);
+ G_PASTE (_cogl_pack_rgb_888_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_BGR_888:
- G_PASTE (_cogl_pack_bgr_888_, component_type) (src, dst, width);
+ G_PASTE (_cogl_pack_bgr_888_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGBA_8888:
case COGL_PIXEL_FORMAT_RGBA_8888_PRE:
- G_PASTE (_cogl_pack_rgba_8888_, component_type) (src, dst, width);
+ G_PASTE (_cogl_pack_rgba_8888_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_BGRA_8888:
case COGL_PIXEL_FORMAT_BGRA_8888_PRE:
- G_PASTE (_cogl_pack_bgra_8888_, component_type) (src, dst, width);
+ G_PASTE (_cogl_pack_bgra_8888_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_ARGB_8888:
case COGL_PIXEL_FORMAT_ARGB_8888_PRE:
- G_PASTE (_cogl_pack_argb_8888_, component_type) (src, dst, width);
+ G_PASTE (_cogl_pack_argb_8888_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_ABGR_8888:
case COGL_PIXEL_FORMAT_ABGR_8888_PRE:
- G_PASTE (_cogl_pack_abgr_8888_, component_type) (src, dst, width);
+ G_PASTE (_cogl_pack_abgr_8888_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGB_565:
- G_PASTE (_cogl_pack_rgb_565_, component_type) (src, dst, width);
+ G_PASTE (_cogl_pack_rgb_565_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGBA_4444:
case COGL_PIXEL_FORMAT_RGBA_4444_PRE:
- G_PASTE (_cogl_pack_rgba_4444_, component_type) (src, dst, width);
+ G_PASTE (_cogl_pack_rgba_4444_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGBA_5551:
case COGL_PIXEL_FORMAT_RGBA_5551_PRE:
- G_PASTE (_cogl_pack_rgba_5551_, component_type) (src, dst, width);
+ G_PASTE (_cogl_pack_rgba_5551_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGBA_1010102:
case COGL_PIXEL_FORMAT_RGBA_1010102_PRE:
- G_PASTE (_cogl_pack_rgba_1010102_, component_type) (src, dst, width);
+ G_PASTE (_cogl_pack_rgba_1010102_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_BGRA_1010102:
case COGL_PIXEL_FORMAT_BGRA_1010102_PRE:
- G_PASTE (_cogl_pack_bgra_1010102_, component_type) (src, dst, width);
+ G_PASTE (_cogl_pack_bgra_1010102_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_ARGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010_PRE:
- G_PASTE (_cogl_pack_argb_2101010_, component_type) (src, dst, width);
+ G_PASTE (_cogl_pack_argb_2101010_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_ABGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
- G_PASTE (_cogl_pack_abgr_2101010_, component_type) (src, dst, width);
+ G_PASTE (_cogl_pack_abgr_2101010_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_DEPTH_16:
case COGL_PIXEL_FORMAT_DEPTH_32: