From ede59ea93c8ee8b5340fc3b862d67820e2eeb6f1 Mon Sep 17 00:00:00 2001 From: Ian Osgood Date: Wed, 18 Oct 2006 07:34:50 -0700 Subject: Rename enumerations to coding standard. Make find_standard_format require the new enum. --- renderutil/util.c | 156 ++++++++++++++++++++++---------------------- renderutil/xcb_renderutil.h | 47 +++++++------ 2 files changed, 101 insertions(+), 102 deletions(-) diff --git a/renderutil/util.c b/renderutil/util.c index 5cd6ac5..2d8840d 100644 --- a/renderutil/util.c +++ b/renderutil/util.c @@ -49,40 +49,40 @@ xcb_render_util_find_format (const xcb_render_query_pict_formats_reply_t *format return 0; for (i = xcb_render_query_pict_formats_formats_iterator(formats); i.rem; xcb_render_pictforminfo_next(&i)) { - if (mask & PictFormatID) + if (mask & XCB_PICT_FORMAT_ID) if (template->id != i.data->id) continue; - if (mask & PictFormatType) + if (mask & XCB_PICT_FORMAT_TYPE) if (template->type != i.data->type) continue; - if (mask & PictFormatDepth) + if (mask & XCB_PICT_FORMAT_DEPTH) if (template->depth != i.data->depth) continue; - if (mask & PictFormatRed) + if (mask & XCB_PICT_FORMAT_RED) if (template->direct.red_shift != i.data->direct.red_shift) continue; - if (mask & PictFormatRedMask) + if (mask & XCB_PICT_FORMAT_RED_MASK) if (template->direct.red_mask != i.data->direct.red_mask) continue; - if (mask & PictFormatGreen) + if (mask & XCB_PICT_FORMAT_GREEN) if (template->direct.green_shift != i.data->direct.green_shift) continue; - if (mask & PictFormatGreenMask) + if (mask & XCB_PICT_FORMAT_GREEN_MASK) if (template->direct.green_mask != i.data->direct.green_mask) continue; - if (mask & PictFormatBlue) + if (mask & XCB_PICT_FORMAT_BLUE) if (template->direct.blue_shift != i.data->direct.blue_shift) continue; - if (mask & PictFormatBlueMask) + if (mask & XCB_PICT_FORMAT_BLUE_MASK) if (template->direct.blue_mask != i.data->direct.blue_mask) continue; - if (mask & PictFormatAlpha) + if (mask & XCB_PICT_FORMAT_ALPHA) if (template->direct.alpha_shift != i.data->direct.alpha_shift) continue; - if (mask & PictFormatAlphaMask) + if (mask & XCB_PICT_FORMAT_ALPHA_MASK) if (template->direct.alpha_mask != i.data->direct.alpha_mask) continue; - if (mask & PictFormatColormap) + if (mask & XCB_PICT_FORMAT_COLORMAP) if (template->colormap != i.data->colormap) continue; if (count-- == 0) @@ -93,13 +93,13 @@ xcb_render_util_find_format (const xcb_render_query_pict_formats_reply_t *format xcb_render_pictforminfo_t * xcb_render_util_find_standard_format (const xcb_render_query_pict_formats_reply_t *formats, - int format) + xcb_pict_standard_t format) { static const struct { xcb_render_pictforminfo_t templ; unsigned long mask; } standardFormats[] = { - /* PictStandardARGB32 */ + /* XCB_PICT_STANDARD_ARGB_32 */ { { 0, /* id */ @@ -108,28 +108,28 @@ xcb_render_util_find_standard_format (const xcb_render_query_pict_formats_reply_ { 0 }, /* pad */ { /* direct */ 16, /* direct.red */ - 0xff, /* direct.redMask */ + 0xff, /* direct.red_mask */ 8, /* direct.green */ - 0xff, /* direct.greenMask */ + 0xff, /* direct.green_mask */ 0, /* direct.blue */ - 0xff, /* direct.blueMask */ + 0xff, /* direct.blue_mask */ 24, /* direct.alpha */ - 0xff, /* direct.alphaMask */ + 0xff, /* direct.alpha_mask */ }, 0, /* colormap */ }, - PictFormatType | - PictFormatDepth | - PictFormatRed | - PictFormatRedMask | - PictFormatGreen | - PictFormatGreenMask | - PictFormatBlue | - PictFormatBlueMask | - PictFormatAlpha | - PictFormatAlphaMask, + XCB_PICT_FORMAT_TYPE | + XCB_PICT_FORMAT_DEPTH | + XCB_PICT_FORMAT_RED | + XCB_PICT_FORMAT_RED_MASK | + XCB_PICT_FORMAT_GREEN | + XCB_PICT_FORMAT_GREEN_MASK | + XCB_PICT_FORMAT_BLUE | + XCB_PICT_FORMAT_BLUE_MASK | + XCB_PICT_FORMAT_ALPHA | + XCB_PICT_FORMAT_ALPHA_MASK, }, - /* PictStandardRGB24 */ + /* XCB_PICT_STANDARD_RGB_24 */ { { 0, /* id */ @@ -138,27 +138,27 @@ xcb_render_util_find_standard_format (const xcb_render_query_pict_formats_reply_ { 0 }, /* pad */ { /* direct */ 16, /* direct.red */ - 0xff, /* direct.redMask */ + 0xff, /* direct.red_MASK */ 8, /* direct.green */ - 0xff, /* direct.greenMask */ + 0xff, /* direct.green_MASK */ 0, /* direct.blue */ - 0xff, /* direct.blueMask */ + 0xff, /* direct.blue_MASK */ 0, /* direct.alpha */ - 0x00, /* direct.alphaMask */ + 0x00, /* direct.alpha_MASK */ }, 0, /* colormap */ }, - PictFormatType | - PictFormatDepth | - PictFormatRed | - PictFormatRedMask | - PictFormatGreen | - PictFormatGreenMask | - PictFormatBlue | - PictFormatBlueMask | - PictFormatAlphaMask, + XCB_PICT_FORMAT_TYPE | + XCB_PICT_FORMAT_DEPTH | + XCB_PICT_FORMAT_RED | + XCB_PICT_FORMAT_RED_MASK | + XCB_PICT_FORMAT_GREEN | + XCB_PICT_FORMAT_GREEN_MASK | + XCB_PICT_FORMAT_BLUE | + XCB_PICT_FORMAT_BLUE_MASK | + XCB_PICT_FORMAT_ALPHA_MASK, }, - /* PictStandardA8 */ + /* XCB_PICT_STANDARD_A_8 */ { { 0, /* id */ @@ -167,25 +167,25 @@ xcb_render_util_find_standard_format (const xcb_render_query_pict_formats_reply_ { 0 }, /* pad */ { /* direct */ 0, /* direct.red */ - 0x00, /* direct.redMask */ + 0x00, /* direct.red_MASK */ 0, /* direct.green */ - 0x00, /* direct.greenMask */ + 0x00, /* direct.green_MASK */ 0, /* direct.blue */ - 0x00, /* direct.blueMask */ + 0x00, /* direct.blue_MASK */ 0, /* direct.alpha */ - 0xff, /* direct.alphaMask */ + 0xff, /* direct.alpha_MASK */ }, 0, /* colormap */ }, - PictFormatType | - PictFormatDepth | - PictFormatRedMask | - PictFormatGreenMask | - PictFormatBlueMask | - PictFormatAlpha | - PictFormatAlphaMask, + XCB_PICT_FORMAT_TYPE | + XCB_PICT_FORMAT_DEPTH | + XCB_PICT_FORMAT_RED_MASK | + XCB_PICT_FORMAT_GREEN_MASK | + XCB_PICT_FORMAT_BLUE_MASK | + XCB_PICT_FORMAT_ALPHA | + XCB_PICT_FORMAT_ALPHA_MASK, }, - /* PictStandardA4 */ + /* XCB_PICT_STANDARD_A_4 */ { { 0, /* id */ @@ -194,25 +194,25 @@ xcb_render_util_find_standard_format (const xcb_render_query_pict_formats_reply_ { 0 }, /* pad */ { /* direct */ 0, /* direct.red */ - 0x00, /* direct.redMask */ + 0x00, /* direct.red_MASK */ 0, /* direct.green */ - 0x00, /* direct.greenMask */ + 0x00, /* direct.green_MASK */ 0, /* direct.blue */ - 0x00, /* direct.blueMask */ + 0x00, /* direct.blue_MASK */ 0, /* direct.alpha */ - 0x0f, /* direct.alphaMask */ + 0x0f, /* direct.alpha_MASK */ }, 0, /* colormap */ }, - PictFormatType | - PictFormatDepth | - PictFormatRedMask | - PictFormatGreenMask | - PictFormatBlueMask | - PictFormatAlpha | - PictFormatAlphaMask, + XCB_PICT_FORMAT_TYPE | + XCB_PICT_FORMAT_DEPTH | + XCB_PICT_FORMAT_RED_MASK | + XCB_PICT_FORMAT_GREEN_MASK | + XCB_PICT_FORMAT_BLUE_MASK | + XCB_PICT_FORMAT_ALPHA | + XCB_PICT_FORMAT_ALPHA_MASK, }, - /* PictStandardA1 */ + /* XCB_PICT_STANDARD_A_1 */ { { 0, /* id */ @@ -221,23 +221,23 @@ xcb_render_util_find_standard_format (const xcb_render_query_pict_formats_reply_ { 0 }, /* pad */ { /* direct */ 0, /* direct.red */ - 0x00, /* direct.redMask */ + 0x00, /* direct.red_MASK */ 0, /* direct.green */ - 0x00, /* direct.greenMask */ + 0x00, /* direct.green_MASK */ 0, /* direct.blue */ - 0x00, /* direct.blueMask */ + 0x00, /* direct.blue_MASK */ 0, /* direct.alpha */ - 0x01, /* direct.alphaMask */ + 0x01, /* direct.alpha_MASK */ }, 0, /* colormap */ }, - PictFormatType | - PictFormatDepth | - PictFormatRedMask | - PictFormatGreenMask | - PictFormatBlueMask | - PictFormatAlpha | - PictFormatAlphaMask, + XCB_PICT_FORMAT_TYPE | + XCB_PICT_FORMAT_DEPTH | + XCB_PICT_FORMAT_RED_MASK | + XCB_PICT_FORMAT_GREEN_MASK | + XCB_PICT_FORMAT_BLUE_MASK | + XCB_PICT_FORMAT_ALPHA | + XCB_PICT_FORMAT_ALPHA_MASK, }, }; diff --git a/renderutil/xcb_renderutil.h b/renderutil/xcb_renderutil.h index 2026585..6eb5923 100644 --- a/renderutil/xcb_renderutil.h +++ b/renderutil/xcb_renderutil.h @@ -27,29 +27,28 @@ #define XCB_RENDERUTIL #include -/* FIXME: These PictFormat declarations should be in render.xml. */ -/* FIXME: update the names for the new XCB naming conventions */ -#define PictFormatID (1 << 0) -#define PictFormatType (1 << 1) -#define PictFormatDepth (1 << 2) -#define PictFormatRed (1 << 3) -#define PictFormatRedMask (1 << 4) -#define PictFormatGreen (1 << 5) -#define PictFormatGreenMask (1 << 6) -#define PictFormatBlue (1 << 7) -#define PictFormatBlueMask (1 << 8) -#define PictFormatAlpha (1 << 9) -#define PictFormatAlphaMask (1 << 10) -#define PictFormatColormap (1 << 11) - -enum { - PictStandardARGB32, - PictStandardRGB24, - PictStandardA8, - PictStandardA4, - PictStandardA1, - PictStandardNUM -}; +typedef enum xcb_pict_format_t { + XCB_PICT_FORMAT_ID = (1 << 0), + XCB_PICT_FORMAT_TYPE = (1 << 1), + XCB_PICT_FORMAT_DEPTH = (1 << 2), + XCB_PICT_FORMAT_RED = (1 << 3), + XCB_PICT_FORMAT_RED_MASK = (1 << 4), + XCB_PICT_FORMAT_GREEN = (1 << 5), + XCB_PICT_FORMAT_GREEN_MASK = (1 << 6), + XCB_PICT_FORMAT_BLUE = (1 << 7), + XCB_PICT_FORMAT_BLUE_MASK = (1 << 8), + XCB_PICT_FORMAT_ALPHA = (1 << 9), + XCB_PICT_FORMAT_ALPHA_MASK = (1 << 10), + XCB_PICT_FORMAT_COLORMAP = (1 << 11) +} xcb_pict_format_t; + +typedef enum xcb_pict_standard_t { + XCB_PICT_STANDARD_ARGB_32, + XCB_PICT_STANDARD_RGB_24, + XCB_PICT_STANDARD_A_8, + XCB_PICT_STANDARD_A_4, + XCB_PICT_STANDARD_A_1 +} xcb_pict_standard_t; xcb_render_pictvisual_t * @@ -64,7 +63,7 @@ xcb_render_util_find_format (const xcb_render_query_pict_formats_reply_t *format xcb_render_pictforminfo_t * xcb_render_util_find_standard_format (const xcb_render_query_pict_formats_reply_t *formats, - int format); + xcb_pict_standard_t format); const xcb_render_query_version_reply_t * xcb_render_util_query_version (xcb_connection_t *c); -- cgit v1.2.3