From 30d0fcef681906a99b810c72d64ba6237dec9395 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 5 Nov 2015 13:44:00 -0800 Subject: [PATCH] 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). --- gfx/thebes/gfxTypes.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gfx/thebes/gfxTypes.h b/gfx/thebes/gfxTypes.h index 1dad160e60d..64ad9e1ef6d 100644 --- a/gfx/thebes/gfxTypes.h +++ b/gfx/thebes/gfxTypes.h @@ -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)