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)
This commit is contained in:
Neil Roberts 2013-01-18 18:14:42 +00:00 committed by Robert Bragg
parent 50005a9364
commit 51f3e28c1f
2 changed files with 90 additions and 86 deletions

View File

@ -32,6 +32,7 @@
#include <string.h>
#define component_type uint8_t
#define component_size 8
/* We want to specially optimise the packing when we are converting
to/from an 8-bit type so that it won't do anything. That way for
example if we are just doing a swizzle conversion then the inner
@ -42,14 +43,17 @@
#undef PACK_BYTE
#undef UNPACK_BYTE
#undef component_type
#undef component_size
#define component_type uint16_t
#define component_size 16
#define UNPACK_BYTE(b) (((b) * 65535 + 127) / 255)
#define PACK_BYTE(b) (((b) * 255 + 32767) / 65535)
#include "cogl-bitmap-packing.h"
#undef PACK_BYTE
#undef UNPACK_BYTE
#undef component_type
#undef component_size
/* (Un)Premultiplication */
@ -205,7 +209,7 @@ _cogl_premult_alpha_last_four_pixels_sse2 (uint8_t *p)
#endif /* COGL_USE_PREMULT_SSE2 */
static void
_cogl_bitmap_premult_unpacked_span_uint8_t (uint8_t *data,
_cogl_bitmap_premult_unpacked_span_8 (uint8_t *data,
int width)
{
#ifdef COGL_USE_PREMULT_SSE2
@ -231,7 +235,7 @@ _cogl_bitmap_premult_unpacked_span_uint8_t (uint8_t *data,
}
static void
_cogl_bitmap_unpremult_unpacked_span_uint8_t (uint8_t *data,
_cogl_bitmap_unpremult_unpacked_span_8 (uint8_t *data,
int width)
{
int x;
@ -247,7 +251,7 @@ _cogl_bitmap_unpremult_unpacked_span_uint8_t (uint8_t *data,
}
static void
_cogl_bitmap_unpremult_unpacked_span_uint16_t (uint16_t *data,
_cogl_bitmap_unpremult_unpacked_span_16 (uint16_t *data,
int width)
{
while (width-- > 0)
@ -266,7 +270,7 @@ _cogl_bitmap_unpremult_unpacked_span_uint16_t (uint16_t *data,
}
static void
_cogl_bitmap_premult_unpacked_span_uint16_t (uint16_t *data,
_cogl_bitmap_premult_unpacked_span_16 (uint16_t *data,
int width)
{
while (width-- > 0)
@ -436,9 +440,9 @@ _cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp,
dst = dst_data + y * dst_rowstride;
if (use_16)
_cogl_unpack_uint16_t (src_format, src, tmp_row, width);
_cogl_unpack_16 (src_format, src, tmp_row, width);
else
_cogl_unpack_uint8_t (src_format, src, tmp_row, width);
_cogl_unpack_8 (src_format, src, tmp_row, width);
/* Handle premultiplication */
if (need_premult)
@ -446,23 +450,23 @@ _cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp,
if (dst_format & COGL_PREMULT_BIT)
{
if (use_16)
_cogl_bitmap_premult_unpacked_span_uint16_t (tmp_row, width);
_cogl_bitmap_premult_unpacked_span_16 (tmp_row, width);
else
_cogl_bitmap_premult_unpacked_span_uint8_t (tmp_row, width);
_cogl_bitmap_premult_unpacked_span_8 (tmp_row, width);
}
else
{
if (use_16)
_cogl_bitmap_unpremult_unpacked_span_uint16_t (tmp_row, width);
_cogl_bitmap_unpremult_unpacked_span_16 (tmp_row, width);
else
_cogl_bitmap_unpremult_unpacked_span_uint8_t (tmp_row, width);
_cogl_bitmap_unpremult_unpacked_span_8 (tmp_row, width);
}
}
if (use_16)
_cogl_pack_uint16_t (dst_format, tmp_row, dst, width);
_cogl_pack_16 (dst_format, tmp_row, dst, width);
else
_cogl_pack_uint8_t (dst_format, tmp_row, dst, width);
_cogl_pack_8 (dst_format, tmp_row, dst, width);
}
_cogl_bitmap_unmap (src_bmp);
@ -539,9 +543,9 @@ _cogl_bitmap_unpremult (CoglBitmap *bmp,
if (tmp_row)
{
_cogl_unpack_uint16_t (format, p, tmp_row, width);
_cogl_bitmap_unpremult_unpacked_span_uint16_t (tmp_row, width);
_cogl_pack_uint16_t (format, tmp_row, p, width);
_cogl_unpack_16 (format, p, tmp_row, width);
_cogl_bitmap_unpremult_unpacked_span_16 (tmp_row, width);
_cogl_pack_16 (format, tmp_row, p, width);
}
else
{
@ -557,7 +561,7 @@ _cogl_bitmap_unpremult (CoglBitmap *bmp,
}
}
else
_cogl_bitmap_unpremult_unpacked_span_uint8_t (p, width);
_cogl_bitmap_unpremult_unpacked_span_8 (p, width);
}
}
@ -606,9 +610,9 @@ _cogl_bitmap_premult (CoglBitmap *bmp,
if (tmp_row)
{
_cogl_unpack_uint16_t (format, p, tmp_row, width);
_cogl_bitmap_premult_unpacked_span_uint16_t (tmp_row, width);
_cogl_pack_uint16_t (format, tmp_row, p, width);
_cogl_unpack_16 (format, p, tmp_row, width);
_cogl_bitmap_premult_unpacked_span_16 (tmp_row, width);
_cogl_pack_16 (format, tmp_row, p, width);
}
else
{
@ -621,7 +625,7 @@ _cogl_bitmap_premult (CoglBitmap *bmp,
}
}
else
_cogl_bitmap_premult_unpacked_span_uint8_t (p, width);
_cogl_bitmap_premult_unpacked_span_8 (p, width);
}
}

View File

@ -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: