diff --git a/src/devices/video/mc6847.cpp b/src/devices/video/mc6847.cpp index 9ec19f56e2b..6b02acddc7b 100644 --- a/src/devices/video/mc6847.cpp +++ b/src/devices/video/mc6847.cpp @@ -558,6 +558,8 @@ mc6847_base_device::mc6847_base_device(const machine_config &mconfig, device_typ { m_bw_palette[i] = black_and_white(s_palette[i]); } + + m_artifacter.create_luma_table( s_palette ); } @@ -1799,6 +1801,23 @@ mc6847_base_device::pixel_t mc6847_base_device::artifacter::mix_color(double fac +//------------------------------------------------- +// artifacter::create_luma_table +//------------------------------------------------- + +void mc6847_base_device::artifacter::create_luma_table( const pixel_t *palette ) +{ + // Luminance map for PAL color blend. Colors with same luminance value are blendable on a PAL display. + m_luminance_map.insert(std::pair(palette[0],2)); /* GREEN */ + m_luminance_map.insert(std::pair(palette[1],1)); /* YELLOW */ + m_luminance_map.insert(std::pair(palette[2],3)); /* BLUE */ + m_luminance_map.insert(std::pair(palette[3],3)); /* RED */ + m_luminance_map.insert(std::pair(palette[4],1)); /* BUFF */ + m_luminance_map.insert(std::pair(palette[5],2)); /* CYAN */ + m_luminance_map.insert(std::pair(palette[6],2)); /* MAGENTA */ + m_luminance_map.insert(std::pair(palette[7],2)); /* ORANGE */ +} + //************************************************************************** // VARIATIONS //************************************************************************** diff --git a/src/devices/video/mc6847.h b/src/devices/video/mc6847.h index c437d1fffd4..bd0994d23d7 100644 --- a/src/devices/video/mc6847.h +++ b/src/devices/video/mc6847.h @@ -13,7 +13,7 @@ #pragma once #include "screen.h" - +#include //************************************************************************** // MC6847 CONFIGURATION / INTERFACE @@ -181,6 +181,7 @@ protected: void poll_config() { m_artifacting = (m_config!=nullptr) ? m_config->read() : 0; } void set_pal_artifacting( bool palartifacting ) { m_palartifacting = palartifacting; } bool get_pal_artifacting() { return m_palartifacting; } + void create_luma_table( const pixel_t *palette ); // artifacting application template @@ -194,10 +195,18 @@ protected: uint32_t tmpPixel; pixel_t *line1 = &bitmap.pix32(y + base_y, base_x); pixel_t *line2 = &bitmap.pix32(y + base_y + 1, base_x); + std::map::const_iterator luma1; + std::map::const_iterator luma2; - for( int pixel = 0; pixel < bitmap.width(); ++pixel ) + for( int pixel = 0; pixel < bitmap.width() - (base_x * 2); ++pixel ) { - if( line1[pixel] != line2[pixel] ) + if( line1[pixel] == line2[pixel] ) + continue; + + luma1 = m_luminance_map.find( line1[pixel] ); + luma2 = m_luminance_map.find( line2[pixel] ); + + if( luma1 != m_luminance_map.end() && luma2 != m_luminance_map.end() && (luma1->second == luma2->second)) { tmpPixel = (( ((line1[pixel] & 0xFF0000) >> 16) + ((line2[pixel] & 0xFF0000) >> 16) / 2) << 16); tmpPixel |= (( ((line1[pixel] & 0xFF00 ) >> 8 ) + ((line2[pixel] & 0xFF00 ) >> 8 ) / 2) << 8 ); @@ -254,6 +263,9 @@ protected: pixel_t m_saved_c0, m_saved_c1; pixel_t m_expanded_colors[128]; + // PAL color blend emulation values. + std::map m_luminance_map; + void update_colors(pixel_t c0, pixel_t c1); static pixel_t mix_color(double factor, uint8_t c0, uint8_t c1); };