From 4a0a76b01237f365358dae400f25dd35b42bb663 Mon Sep 17 00:00:00 2001 From: uz Date: Sun, 11 Mar 2012 11:38:37 +0000 Subject: [PATCH] New function GetBitmapName, inlined GetBitmapColors. git-svn-id: svn://svn.cc65.org/cc65/trunk@5605 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/sp65/bitmap.c | 14 -------------- src/sp65/bitmap.h | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/sp65/bitmap.c b/src/sp65/bitmap.c index e9fa676fb..b6270d246 100644 --- a/src/sp65/bitmap.c +++ b/src/sp65/bitmap.c @@ -178,17 +178,3 @@ Pixel GetPixel (const Bitmap* B, unsigned X, unsigned Y) -unsigned GetBitmapColors (const Bitmap* B) -/* Get the number of colors in an image. The function will return the number - * of palette entries for indexed bitmaps and 2^24 for non indexed bitmaps. - */ -{ - if (B->Pal) { - return B->Pal->Count; - } else { - return (1U << 24); - } -} - - - diff --git a/src/sp65/bitmap.h b/src/sp65/bitmap.h index dc523f1a1..f5423f67f 100644 --- a/src/sp65/bitmap.h +++ b/src/sp65/bitmap.h @@ -157,10 +157,27 @@ INLINE const Palette* GetBitmapPalette (const Bitmap* B) # define GetBitmapPalette(B) ((B)->Pal) #endif -unsigned GetBitmapColors (const Bitmap* B); +#if defined(HAVE_INLINE) +INLINE const StrBuf* GetBitmapName (const Bitmap* B) +/* Get the name of a bitmap */ +{ + return &B->Name; +} +#else +# define GetBitmapName(B) (&(B)->Name) +#endif + +#if defined(HAVE_INLINE) +INLINE unsigned GetBitmapColors (const Bitmap* B) /* Get the number of colors in an image. The function will return the number * of palette entries for indexed bitmaps and 2^24 for non indexed bitmaps. */ +{ + return B->Pal? B->Pal->Count : (1U << 24); +} +#else +# define GetBitmapColors(B) ((B)->Pal? (B)->Pal->Count : (1U << 24)) +#endif