From 9c98656fb1ac10a6085c5db5731b6b986af26165 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 22 Jan 2010 16:11:48 +0000 Subject: [PATCH] color: Add enum value for the largest stock color. Useful if we wish to keep a cache of patterns for the very common stock colors... --- src/cairo-color.c | 13 +++++++------ src/cairo-types-private.h | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/cairo-color.c b/src/cairo-color.c index 7640bf436..255bd362b 100644 --- a/src/cairo-color.c +++ b/src/cairo-color.c @@ -67,13 +67,14 @@ _cairo_stock_color (cairo_stock_t stock) return &cairo_color_black; case CAIRO_STOCK_TRANSPARENT: return &cairo_color_transparent; - } - - ASSERT_NOT_REACHED; - /* If the user can get here somehow, give a color that indicates a - * problem. */ - return &cairo_color_magenta; + case CAIRO_STOCK_NUM_COLORS: + default: + ASSERT_NOT_REACHED; + /* If the user can get here somehow, give a color that indicates a + * problem. */ + return &cairo_color_magenta; + } } void diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h index 66370e3e8..ca41c1a1f 100644 --- a/src/cairo-types-private.h +++ b/src/cairo-types-private.h @@ -306,7 +306,8 @@ typedef struct _cairo_format_masks { typedef enum { CAIRO_STOCK_WHITE, CAIRO_STOCK_BLACK, - CAIRO_STOCK_TRANSPARENT + CAIRO_STOCK_TRANSPARENT, + CAIRO_STOCK_NUM_COLORS, } cairo_stock_t; typedef enum _cairo_image_transparency {