summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-09-27 20:36:04 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-09-27 20:36:04 +0000
commit9766dc2367e3d430beb3cd921f073426d65223d2 (patch)
treeffbc5b90790c2fa0d23e3e50330b28e0d573d85a
parentc391ab646f0fb9ea157213eca83a3b7a193ed9e5 (diff)
Changed MAKE_RGB macro to set the alpha to 255 instead of 0. Updated
palette.c to preserve the alpha when transforming palette values. These changes should be transparent to almost all drivers and rendering (ha-ha), but there may be an occasional instance where a driver relied on the alpha being 0 in the system palette. This also means that the palette_set_color() function preserves any alpha value that is set. Changed Firefox to RGB32 to allow for mid-screen palette changes. Because of the above change, the hacky alpha manipulation that was previously required is no longer necessary; the alpha is set directly in the palette entry.
-rw-r--r--src/lib/util/palette.c3
-rw-r--r--src/lib/util/palette.h8
-rw-r--r--src/mame/drivers/firefox.c9
3 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/util/palette.c b/src/lib/util/palette.c
index 6afb73aa478..eec488005bb 100644
--- a/src/lib/util/palette.c
+++ b/src/lib/util/palette.c
@@ -80,7 +80,8 @@ INLINE rgb_t adjust_palette_entry(rgb_t entry, float brightness, float contrast)
int r = rgb_clamp((float)RGB_RED(entry) * contrast + brightness);
int g = rgb_clamp((float)RGB_GREEN(entry) * contrast + brightness);
int b = rgb_clamp((float)RGB_BLUE(entry) * contrast + brightness);
- return MAKE_RGB(r,g,b);
+ int a = RGB_ALPHA(entry);
+ return MAKE_ARGB(a,r,g,b);
}
diff --git a/src/lib/util/palette.h b/src/lib/util/palette.h
index 3234e198e0d..afd3b4eca1a 100644
--- a/src/lib/util/palette.h
+++ b/src/lib/util/palette.h
@@ -40,8 +40,8 @@ typedef struct _palette_client palette_client;
***************************************************************************/
/* macros to assemble rgb_t values */
-#define MAKE_RGB(r,g,b) ((((rgb_t)(r) & 0xff) << 16) | (((rgb_t)(g) & 0xff) << 8) | ((rgb_t)(b) & 0xff))
-#define MAKE_ARGB(a,r,g,b) (MAKE_RGB(r,g,b) | (((rgb_t)(a) & 0xff) << 24))
+#define MAKE_ARGB(a,r,g,b) ((((rgb_t)(a) & 0xff) << 24) | (((rgb_t)(r) & 0xff) << 16) | (((rgb_t)(g) & 0xff) << 8) | ((rgb_t)(b) & 0xff))
+#define MAKE_RGB(r,g,b) (MAKE_ARGB(255,r,g,b))
/* macros to extract components from rgb_t values */
#define RGB_ALPHA(rgb) (((rgb) >> 24) & 0xff)
@@ -50,8 +50,8 @@ typedef struct _palette_client palette_client;
#define RGB_BLUE(rgb) ((rgb) & 0xff)
/* common colors */
-#define RGB_BLACK (MAKE_RGB(0,0,0))
-#define RGB_WHITE (MAKE_RGB(255,255,255))
+#define RGB_BLACK (MAKE_ARGB(255,0,0,0))
+#define RGB_WHITE (MAKE_ARGB(255,255,255,255))
diff --git a/src/mame/drivers/firefox.c b/src/mame/drivers/firefox.c
index d1e3090feca..27d134a5697 100644
--- a/src/mame/drivers/firefox.c
+++ b/src/mame/drivers/firefox.c
@@ -153,7 +153,7 @@ static VIDEO_UPDATE( firefox )
int sprite;
int gfxtop = video_screen_get_visible_area(screen)->min_y;
- fillbitmap( bitmap, 256, cliprect );
+ fillbitmap( bitmap, palette_get_color(screen->machine, 256), cliprect );
for( y = 0; y < 64; y++ )
{
@@ -203,8 +203,7 @@ static void set_rgba( running_machine *machine, int start, int index, unsigned c
int b = palette_ram[ index + 512 ];
int a = ( b & 3 ) * 0x55;
- palette_set_color( machine, start + index, MAKE_RGB( r, g, b ) );
- render_container_set_palette_alpha(render_container_get_screen(machine->primary_screen), start + index, a);
+ palette_set_color( machine, start + index, MAKE_ARGB( a, r, g, b ) );
}
static WRITE8_HANDLER( tile_palette_w )
@@ -654,13 +653,13 @@ static MACHINE_DRIVER_START( firefox )
MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_HZ((double)MASTER_XTAL/8/16/16/16/16))
/* video hardware */
- MDRV_LASERDISC_SCREEN_ADD_NTSC("main", BITMAP_FORMAT_INDEXED16)
+ MDRV_LASERDISC_SCREEN_ADD_NTSC("main", BITMAP_FORMAT_RGB32)
MDRV_GFXDECODE(firefox)
MDRV_PALETTE_LENGTH(512)
MDRV_LASERDISC_ADD("laserdisc", PHILLIPS_22VP931, "main", "ldsound")
- MDRV_LASERDISC_OVERLAY(firefox, 64*8, 525, BITMAP_FORMAT_INDEXED16)
+ MDRV_LASERDISC_OVERLAY(firefox, 64*8, 525, BITMAP_FORMAT_RGB32)
MDRV_LASERDISC_OVERLAY_CLIP(7*8, 53*8-1, 44, 480+44)
MDRV_DEVICE_ADD("nvram_1c",X2212)