From c3c7f2e5e366313ea8b25c507bdd0f214509251a Mon Sep 17 00:00:00 2001 From: sam Date: Thu, 28 Aug 2008 21:43:52 +0000 Subject: [PATCH] * Add "8bit" to the list of supported template flags. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2794 92316355-f0b4-4df1-b90c-862c8a59935f --- pipi/pipi_internals.h | 1 + pipi/pipi_template.h | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/pipi/pipi_internals.h b/pipi/pipi_internals.h index 0934c9b..775ded8 100644 --- a/pipi/pipi_internals.h +++ b/pipi/pipi_internals.h @@ -21,6 +21,7 @@ #define SET_FLAG_GRAY 0x00000001 #define SET_FLAG_WRAP 0x00000002 +#define SET_FLAG_8BIT 0x00000004 /* pipi_image_t: the image structure. This is probably going to be the most * complex structure in the library, but right now it only has fairly normal diff --git a/pipi/pipi_template.h b/pipi/pipi_template.h index 39ad2db..afec77b 100644 --- a/pipi/pipi_template.h +++ b/pipi/pipi_template.h @@ -46,20 +46,46 @@ # include __FILE__ # undef FLAG_WRAP +#elif !defined FLAG_8BIT +# if (TEMPLATE_FLAGS) & SET_FLAG_8BIT +# define FLAG_8BIT 1 +# include __FILE__ +# undef FLAG_8BIT +# endif +# define FLAG_8BIT 0 +# include __FILE__ +# undef FLAG_8BIT + #else /* FIXME: I couldn't find a way to do this in one preprocessor pass, * too many levels of indirection seem to be needed. */ -# if FLAG_GRAY +# if FLAG_8BIT # if FLAG_WRAP -# define SUFFIX(x) x##_gray_wrap +# if FLAG_GRAY +# define SUFFIX(x) x##_gray_wrap_8bit +# else +# define SUFFIX(x) x##_wrap_8bit +# endif # else -# define SUFFIX(x) x##_gray +# if FLAG_GRAY +# define SUFFIX(x) x##_gray_8bit +# else +# define SUFFIX(x) x##_8bit +# endif # endif # else # if FLAG_WRAP -# define SUFFIX(x) x##_wrap +# if FLAG_GRAY +# define SUFFIX(x) x##_gray_wrap +# else +# define SUFFIX(x) x##_wrap +# endif # else -# define SUFFIX(x) x +# if FLAG_GRAY +# define SUFFIX(x) x##_gray +# else +# define SUFFIX(x) x +# endif # endif # endif # include TEMPLATE_FILE