mirror of
https://github.com/holub/mame
synced 2025-10-07 09:25:34 +03:00
Change palette_t allocation so that it uses matching new/delete operators.
This commit is contained in:
parent
d048dae125
commit
64d9280eb6
@ -593,7 +593,7 @@ static void allocate_palette(running_machine &machine, palette_private *palette)
|
|||||||
assert_always(machine.total_colors() * numgroups <= 65536, "Error: palette has more than 65536 colors.");
|
assert_always(machine.total_colors() * numgroups <= 65536, "Error: palette has more than 65536 colors.");
|
||||||
|
|
||||||
/* allocate a palette object containing all the colors and groups */
|
/* allocate a palette object containing all the colors and groups */
|
||||||
machine.palette = new palette_t(machine.total_colors(), numgroups);
|
machine.palette = palette_t::alloc(machine.total_colors(), numgroups);
|
||||||
|
|
||||||
/* configure the groups */
|
/* configure the groups */
|
||||||
if (palette->shadow_group != 0)
|
if (palette->shadow_group != 0)
|
||||||
|
@ -769,7 +769,7 @@ void laserdisc_device::init_video()
|
|||||||
m_screen->register_vblank_callback(vblank_state_delegate(FUNC(laserdisc_device::vblank_state_changed), this));
|
m_screen->register_vblank_callback(vblank_state_delegate(FUNC(laserdisc_device::vblank_state_changed), this));
|
||||||
|
|
||||||
// allocate palette for applying brightness/contrast/gamma
|
// allocate palette for applying brightness/contrast/gamma
|
||||||
m_videopalette = new palette_t(256);
|
m_videopalette = palette_t::alloc(256);
|
||||||
if (m_videopalette == NULL)
|
if (m_videopalette == NULL)
|
||||||
throw emu_fatalerror("Out of memory allocating video palette");
|
throw emu_fatalerror("Out of memory allocating video palette");
|
||||||
for (int index = 0; index < 256; index++)
|
for (int index = 0; index < 256; index++)
|
||||||
|
@ -188,6 +188,16 @@ const UINT32 *palette_client::dirty_list(UINT32 &mindirty, UINT32 &maxdirty)
|
|||||||
// PALETTE_T
|
// PALETTE_T
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// alloc - static allocator
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
palette_t *palette_t::alloc(UINT32 numcolors, UINT32 numgroups)
|
||||||
|
{
|
||||||
|
return new palette_t(numcolors, numgroups);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// palette_t - constructor
|
// palette_t - constructor
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
@ -106,8 +106,8 @@ class palette_t
|
|||||||
friend class palette_client;
|
friend class palette_client;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// construction/destruction
|
// static constructor: used to ensure same new/delete is used
|
||||||
palette_t(UINT32 numcolors, UINT32 numgroups = 1);
|
static palette_t *alloc(UINT32 numcolors, UINT32 numgroups = 1);
|
||||||
|
|
||||||
// reference counting
|
// reference counting
|
||||||
void ref() { m_refcount++; }
|
void ref() { m_refcount++; }
|
||||||
@ -147,7 +147,8 @@ public:
|
|||||||
void normalize_range(UINT32 start, UINT32 end, int lum_min = 0, int lum_max = 255);
|
void normalize_range(UINT32 start, UINT32 end, int lum_min = 0, int lum_max = 255);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// destructor -- can only destruct via
|
// construction/destruction
|
||||||
|
palette_t(UINT32 numcolors, UINT32 numgroups = 1);
|
||||||
~palette_t();
|
~palette_t();
|
||||||
|
|
||||||
// internal helpers
|
// internal helpers
|
||||||
|
Loading…
Reference in New Issue
Block a user