mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
- Added colortable_palette_get_size()
- Added some more asserts
This commit is contained in:
parent
01dac00ae0
commit
2eb626efdd
@ -369,6 +369,9 @@ colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize)
|
||||
colortable_t *ctable;
|
||||
UINT32 index;
|
||||
|
||||
assert(machine != NULL);
|
||||
assert(machine->drv != NULL);
|
||||
|
||||
/* allocate the colortable */
|
||||
ctable = auto_malloc(sizeof(*ctable));
|
||||
memset(ctable, 0, sizeof(*ctable));
|
||||
@ -402,6 +405,7 @@ colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize)
|
||||
void colortable_entry_set_value(colortable_t *ctable, UINT32 entry, UINT16 value)
|
||||
{
|
||||
/* ensure values are within range */
|
||||
assert(ctable != NULL);
|
||||
assert(entry < ctable->entries);
|
||||
assert(value < ctable->palentries);
|
||||
|
||||
@ -421,6 +425,7 @@ void colortable_entry_set_value(colortable_t *ctable, UINT32 entry, UINT16 value
|
||||
|
||||
UINT16 colortable_entry_get_value(colortable_t *ctable, UINT32 entry)
|
||||
{
|
||||
assert(ctable != NULL);
|
||||
assert(entry < ctable->entries);
|
||||
return ctable->raw[entry];
|
||||
}
|
||||
@ -434,6 +439,7 @@ UINT16 colortable_entry_get_value(colortable_t *ctable, UINT32 entry)
|
||||
void colortable_palette_set_color(colortable_t *ctable, UINT32 entry, rgb_t color)
|
||||
{
|
||||
/* ensure values are within range */
|
||||
assert(ctable != NULL);
|
||||
assert(entry < ctable->palentries);
|
||||
|
||||
/* alpha doesn't matter */
|
||||
@ -461,6 +467,7 @@ void colortable_palette_set_color(colortable_t *ctable, UINT32 entry, rgb_t colo
|
||||
|
||||
rgb_t colortable_palette_get_color(colortable_t *ctable, UINT32 entry)
|
||||
{
|
||||
assert(ctable != NULL);
|
||||
assert(entry < ctable->palentries);
|
||||
return ctable->palette[entry];
|
||||
}
|
||||
@ -479,6 +486,7 @@ UINT32 colortable_get_transpen_mask(colortable_t *ctable, const gfx_element *gfx
|
||||
UINT32 count, bit;
|
||||
|
||||
/* make sure we are in range */
|
||||
assert(ctable != NULL);
|
||||
assert(entry < ctable->entries);
|
||||
assert(gfx->color_depth <= 32);
|
||||
|
||||
@ -506,6 +514,9 @@ void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap *tmap, co
|
||||
{
|
||||
int color;
|
||||
|
||||
assert(ctable != NULL);
|
||||
assert(gfx != NULL);
|
||||
assert(tmap != NULL);
|
||||
assert(gfx->total_colors <= TILEMAP_NUM_GROUPS);
|
||||
|
||||
/* iterate over all colors in the tilemap */
|
||||
@ -514,6 +525,18 @@ void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap *tmap, co
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
colortable_palette_get_size -
|
||||
return the number of entries in a colortable
|
||||
-------------------------------------------------*/
|
||||
|
||||
UINT32 colortable_palette_get_size(colortable_t *ctable)
|
||||
{
|
||||
assert(ctable != NULL);
|
||||
return ctable->palentries;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
UTILITIES
|
||||
|
@ -174,6 +174,9 @@ UINT32 colortable_get_transpen_mask(colortable_t *ctable, const gfx_element *gfx
|
||||
/* configure groups in a tilemap to represent transparency based on colortable entries (each group maps to a gfx color) */
|
||||
void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap *tmap, const gfx_element *gfx, int transcolor);
|
||||
|
||||
/* return the number of entries in a colortable */
|
||||
UINT32 colortable_palette_get_size(colortable_t *ctable);
|
||||
|
||||
|
||||
|
||||
/* ----- utilities ----- */
|
||||
|
Loading…
Reference in New Issue
Block a user