Bug 1222171 - Re-establish equivalence between gfxImageFormat and cairo_format_t. r=mstange.

It would be nice to add static assertions for this equivalence but I don't want
to have to include cairo.h in gfxTypes.h. (Indeed, that's why
gfxImageFormatToCairoFormat and gfxCairoFormatToImageFormat are macros in the
first place).
This commit is contained in:
Nicholas Nethercote 2015-11-05 13:44:00 -08:00
parent c304101228
commit 30d0fcef68

View File

@ -47,24 +47,28 @@ enum class gfxBreakPriority {
/**
* The format for an image surface. For all formats with alpha data, 0
* means transparent, 1 or 255 means fully opaque.
*
* XXX: it's vital that the values here match the values in cairo_format_t,
* otherwise gfxCairoFormatToImageFormat() and gfxImageFormatToCairoFormat()
* won't work.
*/
enum class gfxImageFormat {
ARGB32, ///< ARGB data in native endianness, using premultiplied alpha
RGB24, ///< xRGB data in native endianness
A8, ///< Only an alpha channel
RGB16_565, ///< RGB_565 data in native endianness
ARGB32 = 0, ///< ARGB data in native endianness, using premultiplied alpha
RGB24 = 1, ///< xRGB data in native endianness
A8 = 2, ///< Only an alpha channel
RGB16_565 = 4, ///< RGB_565 data in native endianness
Unknown
};
// XXX: temporary
// This works because the gfxImageFormat enum is defined so as to match the
// _cairo_format enum.
// cairo_format_t enum.
#define gfxCairoFormatToImageFormat(aFormat) \
((gfxImageFormat)aFormat)
// XXX: temporary
// This works because the gfxImageFormat enum is defined so as to match the
// _cairo_format enum.
// cairo_format_t enum.
#define gfxImageFormatToCairoFormat(aFormat) \
((cairo_format_t)aFormat)