From 5cdc9af18a2ab36b1a166a462db69876cb5015dd Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Fri, 17 Feb 2012 20:24:14 +0000 Subject: [PATCH] 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 --- cogl/cogl-types.h | 22 +++++++++---------- .../cogl-2.0-experimental-sections.txt | 2 -- doc/reference/cogl/cogl-sections.txt | 2 -- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/cogl/cogl-types.h b/cogl/cogl-types.h index 43b8c25ab..96a44e14b 100644 --- a/cogl/cogl-types.h +++ b/cogl/cogl-types.h @@ -163,8 +163,6 @@ typedef struct _CoglTextureVertex CoglTextureVertex; /* Enum declarations */ -#define COGL_PIXEL_FORMAT_24 2 -#define COGL_PIXEL_FORMAT_32 3 #define COGL_A_BIT (1 << 4) #define COGL_BGR_BIT (1 << 5) #define COGL_AFIRST_BIT (1 << 6) @@ -222,18 +220,18 @@ typedef enum { /*< prefix=COGL_PIXEL_FORMAT >*/ COGL_PIXEL_FORMAT_YUV = 7, COGL_PIXEL_FORMAT_G_8 = 8, - COGL_PIXEL_FORMAT_RGB_888 = COGL_PIXEL_FORMAT_24, - COGL_PIXEL_FORMAT_BGR_888 = (COGL_PIXEL_FORMAT_24 | COGL_BGR_BIT), + COGL_PIXEL_FORMAT_RGB_888 = 2, + COGL_PIXEL_FORMAT_BGR_888 = (2 | COGL_BGR_BIT), - COGL_PIXEL_FORMAT_RGBA_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT), - COGL_PIXEL_FORMAT_BGRA_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_BGR_BIT), - COGL_PIXEL_FORMAT_ARGB_8888 = (COGL_PIXEL_FORMAT_32 | 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_RGBA_8888 = (3 | COGL_A_BIT), + COGL_PIXEL_FORMAT_BGRA_8888 = (3 | COGL_A_BIT | COGL_BGR_BIT), + COGL_PIXEL_FORMAT_ARGB_8888 = (3 | COGL_A_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_BGRA_8888_PRE = (COGL_PIXEL_FORMAT_32 | 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_ABGR_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT), + COGL_PIXEL_FORMAT_RGBA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT), + COGL_PIXEL_FORMAT_BGRA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT), + COGL_PIXEL_FORMAT_ARGB_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_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_5551_PRE = (COGL_PIXEL_FORMAT_RGBA_5551 | COGL_A_BIT | COGL_PREMULT_BIT) } CoglPixelFormat; diff --git a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt index 2f9632785..787e7d5be 100644 --- a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt +++ b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt @@ -160,8 +160,6 @@ cogl_vertices_mode_get_type COGL_AFIRST_BIT COGL_A_BIT COGL_BGR_BIT -COGL_PIXEL_FORMAT_24 -COGL_PIXEL_FORMAT_32 COGL_PREMULT_BIT diff --git a/doc/reference/cogl/cogl-sections.txt b/doc/reference/cogl/cogl-sections.txt index 15b469cb2..c08660328 100644 --- a/doc/reference/cogl/cogl-sections.txt +++ b/doc/reference/cogl/cogl-sections.txt @@ -122,8 +122,6 @@ cogl_vertices_mode_get_type COGL_AFIRST_BIT COGL_A_BIT COGL_BGR_BIT -COGL_PIXEL_FORMAT_24 -COGL_PIXEL_FORMAT_32 COGL_PREMULT_BIT