summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2012-04-05 07:44:51 +0000
committer Aaron Giles <aaron@aarongiles.com>2012-04-05 07:44:51 +0000
commit194397db29bbf4b5bbf1f22c8fb5a16c39fffa06 (patch)
tree5e6e746191732095345bc7a8ffa6fd4645e530fd /src/lib
parent82a1191455181e8a74836a6f597a23f288be82d0 (diff)
Moved all drivers to using the paletteram helpers defined in the
driver_device base class. The palette base is now specified via an AM_SHARE of "paletteram" or "paletteram2". The driver_device base class now finds these pointers and places them in m_generic_paletteram_8/_16/_32 and m_generic_paletteram2_8/_16/_32. Removed machine.generic.paletteram*, and machine.generic entirely. Removed AM_BASE_GENERIC/AM_SIZE_GENERIC as they don't apply anymore. Changed required_/optional_shared_ptr to support set_target with base and size for manually configuring a shared pointer, and a new allocate method for dynamically allocating (and registering the memory for save states). A few subsequent cleanups are coming related to this, but wanted to get this in before the next modern push.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/util/palette.h73
1 files changed, 64 insertions, 9 deletions
diff --git a/src/lib/util/palette.h b/src/lib/util/palette.h
index 53c92ee3842..39b643d361c 100644
--- a/src/lib/util/palette.h
+++ b/src/lib/util/palette.h
@@ -200,7 +200,7 @@ void palette_normalize_range(palette_t *palette, UINT32 start, UINT32 end, int l
a 15-bit OSD-specified RGB value
-------------------------------------------------*/
-INLINE rgb15_t rgb_to_rgb15(rgb_t rgb)
+inline rgb15_t rgb_to_rgb15(rgb_t rgb)
{
return ((RGB_RED(rgb) >> 3) << 10) | ((RGB_GREEN(rgb) >> 3) << 5) | ((RGB_BLUE(rgb) >> 3) << 0);
}
@@ -210,7 +210,7 @@ INLINE rgb15_t rgb_to_rgb15(rgb_t rgb)
rgb_clamp - clamp an RGB component to 0-255
-------------------------------------------------*/
-INLINE UINT8 rgb_clamp(INT32 value)
+inline UINT8 rgb_clamp(INT32 value)
{
if (value < 0)
return 0;
@@ -224,7 +224,7 @@ INLINE UINT8 rgb_clamp(INT32 value)
pal1bit - convert a 1-bit value to 8 bits
-------------------------------------------------*/
-INLINE UINT8 pal1bit(UINT8 bits)
+inline UINT8 pal1bit(UINT8 bits)
{
return (bits & 1) ? 0xff : 0x00;
}
@@ -234,7 +234,7 @@ INLINE UINT8 pal1bit(UINT8 bits)
pal2bit - convert a 2-bit value to 8 bits
-------------------------------------------------*/
-INLINE UINT8 pal2bit(UINT8 bits)
+inline UINT8 pal2bit(UINT8 bits)
{
bits &= 3;
return (bits << 6) | (bits << 4) | (bits << 2) | bits;
@@ -245,7 +245,7 @@ INLINE UINT8 pal2bit(UINT8 bits)
pal3bit - convert a 3-bit value to 8 bits
-------------------------------------------------*/
-INLINE UINT8 pal3bit(UINT8 bits)
+inline UINT8 pal3bit(UINT8 bits)
{
bits &= 7;
return (bits << 5) | (bits << 2) | (bits >> 1);
@@ -256,7 +256,7 @@ INLINE UINT8 pal3bit(UINT8 bits)
pal4bit - convert a 4-bit value to 8 bits
-------------------------------------------------*/
-INLINE UINT8 pal4bit(UINT8 bits)
+inline UINT8 pal4bit(UINT8 bits)
{
bits &= 0xf;
return (bits << 4) | bits;
@@ -267,7 +267,7 @@ INLINE UINT8 pal4bit(UINT8 bits)
pal5bit - convert a 5-bit value to 8 bits
-------------------------------------------------*/
-INLINE UINT8 pal5bit(UINT8 bits)
+inline UINT8 pal5bit(UINT8 bits)
{
bits &= 0x1f;
return (bits << 3) | (bits >> 2);
@@ -278,7 +278,7 @@ INLINE UINT8 pal5bit(UINT8 bits)
pal6bit - convert a 6-bit value to 8 bits
-------------------------------------------------*/
-INLINE UINT8 pal6bit(UINT8 bits)
+inline UINT8 pal6bit(UINT8 bits)
{
bits &= 0x3f;
return (bits << 2) | (bits >> 4);
@@ -289,11 +289,66 @@ INLINE UINT8 pal6bit(UINT8 bits)
pal7bit - convert a 7-bit value to 8 bits
-------------------------------------------------*/
-INLINE UINT8 pal7bit(UINT8 bits)
+inline UINT8 pal7bit(UINT8 bits)
{
bits &= 0x7f;
return (bits << 1) | (bits >> 6);
}
+/*-------------------------------------------------
+ pal332 - create a 3-3-2 color by extracting
+ bits from a UINT32
+-------------------------------------------------*/
+
+inline rgb_t pal332(UINT32 data, UINT8 rshift, UINT8 gshift, UINT8 bshift)
+{
+ return MAKE_RGB(pal3bit(data >> rshift), pal3bit(data >> gshift), pal2bit(data >> bshift));
+}
+
+
+/*-------------------------------------------------
+ pal444 - create a 4-4-4 color by extracting
+ bits from a UINT32
+-------------------------------------------------*/
+
+inline rgb_t pal444(UINT32 data, UINT8 rshift, UINT8 gshift, UINT8 bshift)
+{
+ return MAKE_RGB(pal4bit(data >> rshift), pal4bit(data >> gshift), pal4bit(data >> bshift));
+}
+
+
+/*-------------------------------------------------
+ pal555 - create a 5-5-5 color by extracting
+ bits from a UINT32
+-------------------------------------------------*/
+
+inline rgb_t pal555(UINT32 data, UINT8 rshift, UINT8 gshift, UINT8 bshift)
+{
+ return MAKE_RGB(pal5bit(data >> rshift), pal5bit(data >> gshift), pal5bit(data >> bshift));
+}
+
+
+/*-------------------------------------------------
+ pal565 - create a 5-6-5 color by extracting
+ bits from a UINT32
+-------------------------------------------------*/
+
+inline rgb_t pal565(UINT32 data, UINT8 rshift, UINT8 gshift, UINT8 bshift)
+{
+ return MAKE_RGB(pal5bit(data >> rshift), pal6bit(data >> gshift), pal5bit(data >> bshift));
+}
+
+
+/*-------------------------------------------------
+ pal888 - create a 8-8-8 color by extracting
+ bits from a UINT32
+-------------------------------------------------*/
+
+inline rgb_t pal888(UINT32 data, UINT8 rshift, UINT8 gshift, UINT8 bshift)
+{
+ return MAKE_RGB(data >> rshift, data >> gshift, data >> bshift);
+}
+
+
#endif /* __PALETTE_H__ */