Removes the COGL_PIXEL_FORMAT_{24,32} defines

Although these are in the public headers we should assume that no one is
using them since they were never documented so no could know what they
are useful for.

If you were to guess you'd be forgiven for thinking they were bitmasks
for checking some flags to see if a format is 24 or 32 bits. If you
looked further you might instead be forgiven for thinking that if you
masked of the least significant nibble of a pixel-format then you could
check the value against these defines. Neither of the previous
operations are reliable ways to check if a format is 24 or 32bit and
instead code must use then internal
_cogl_pixel_format_get_bytes_per_pixel() api if they want to know the
pixel size for a given format which relies on a 16 entry lookup table
using the least significant nibble of a pixel-format.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg 2012-02-17 20:24:14 +00:00
parent e43246fe1c
commit 5cdc9af18a
3 changed files with 10 additions and 16 deletions

View File

@ -163,8 +163,6 @@ typedef struct _CoglTextureVertex CoglTextureVertex;
/* Enum declarations */ /* Enum declarations */
#define COGL_PIXEL_FORMAT_24 2
#define COGL_PIXEL_FORMAT_32 3
#define COGL_A_BIT (1 << 4) #define COGL_A_BIT (1 << 4)
#define COGL_BGR_BIT (1 << 5) #define COGL_BGR_BIT (1 << 5)
#define COGL_AFIRST_BIT (1 << 6) #define COGL_AFIRST_BIT (1 << 6)
@ -222,18 +220,18 @@ typedef enum { /*< prefix=COGL_PIXEL_FORMAT >*/
COGL_PIXEL_FORMAT_YUV = 7, COGL_PIXEL_FORMAT_YUV = 7,
COGL_PIXEL_FORMAT_G_8 = 8, COGL_PIXEL_FORMAT_G_8 = 8,
COGL_PIXEL_FORMAT_RGB_888 = COGL_PIXEL_FORMAT_24, COGL_PIXEL_FORMAT_RGB_888 = 2,
COGL_PIXEL_FORMAT_BGR_888 = (COGL_PIXEL_FORMAT_24 | COGL_BGR_BIT), COGL_PIXEL_FORMAT_BGR_888 = (2 | COGL_BGR_BIT),
COGL_PIXEL_FORMAT_RGBA_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT), COGL_PIXEL_FORMAT_RGBA_8888 = (3 | COGL_A_BIT),
COGL_PIXEL_FORMAT_BGRA_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_BGR_BIT), COGL_PIXEL_FORMAT_BGRA_8888 = (3 | COGL_A_BIT | COGL_BGR_BIT),
COGL_PIXEL_FORMAT_ARGB_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_AFIRST_BIT), COGL_PIXEL_FORMAT_ARGB_8888 = (3 | COGL_A_BIT | COGL_AFIRST_BIT),
COGL_PIXEL_FORMAT_ABGR_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT), COGL_PIXEL_FORMAT_ABGR_8888 = (3 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
COGL_PIXEL_FORMAT_RGBA_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT), COGL_PIXEL_FORMAT_RGBA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT),
COGL_PIXEL_FORMAT_BGRA_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT), COGL_PIXEL_FORMAT_BGRA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT),
COGL_PIXEL_FORMAT_ARGB_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_AFIRST_BIT), COGL_PIXEL_FORMAT_ARGB_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_AFIRST_BIT),
COGL_PIXEL_FORMAT_ABGR_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT), COGL_PIXEL_FORMAT_ABGR_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
COGL_PIXEL_FORMAT_RGBA_4444_PRE = (COGL_PIXEL_FORMAT_RGBA_4444 | COGL_A_BIT | COGL_PREMULT_BIT), COGL_PIXEL_FORMAT_RGBA_4444_PRE = (COGL_PIXEL_FORMAT_RGBA_4444 | COGL_A_BIT | COGL_PREMULT_BIT),
COGL_PIXEL_FORMAT_RGBA_5551_PRE = (COGL_PIXEL_FORMAT_RGBA_5551 | COGL_A_BIT | COGL_PREMULT_BIT) COGL_PIXEL_FORMAT_RGBA_5551_PRE = (COGL_PIXEL_FORMAT_RGBA_5551 | COGL_A_BIT | COGL_PREMULT_BIT)
} CoglPixelFormat; } CoglPixelFormat;

View File

@ -160,8 +160,6 @@ cogl_vertices_mode_get_type
COGL_AFIRST_BIT COGL_AFIRST_BIT
COGL_A_BIT COGL_A_BIT
COGL_BGR_BIT COGL_BGR_BIT
COGL_PIXEL_FORMAT_24
COGL_PIXEL_FORMAT_32
COGL_PREMULT_BIT COGL_PREMULT_BIT
</SECTION> </SECTION>

View File

@ -122,8 +122,6 @@ cogl_vertices_mode_get_type
COGL_AFIRST_BIT COGL_AFIRST_BIT
COGL_A_BIT COGL_A_BIT
COGL_BGR_BIT COGL_BGR_BIT
COGL_PIXEL_FORMAT_24
COGL_PIXEL_FORMAT_32
COGL_PREMULT_BIT COGL_PREMULT_BIT
</SECTION> </SECTION>