mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
Better than overly literal conversion (nw)
This commit is contained in:
parent
c24f997696
commit
4c10fcbed2
@ -18,11 +18,10 @@
|
||||
***************************************************************************/
|
||||
|
||||
const rgbaint_t::VECU16 rgbaint_t::maxbyte = { 255, 255, 255, 255, 255, 255, 255, 255 };
|
||||
const rgbaint_t::VECU32 rgbaint_t::alpha_mask = { 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff };
|
||||
const rgbaint_t::VECU32 rgbaint_t::red_mask = { 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff };
|
||||
const rgbaint_t::VECU32 rgbaint_t::green_mask = { 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff };
|
||||
const rgbaint_t::VECU32 rgbaint_t::blue_mask = { 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000 };
|
||||
const rgbaint_t::VECU8 rgbaint_t::merge_alpha_perm = { 16, 17, 18, 19, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
|
||||
const rgbaint_t::VECU8 rgbaint_t::alpha_perm = { 16, 17, 18, 19, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
|
||||
const rgbaint_t::VECU8 rgbaint_t::red_perm = { 0, 1, 2, 3, 16, 17, 18, 19, 8, 9, 10, 11, 12, 13, 14, 15 };
|
||||
const rgbaint_t::VECU8 rgbaint_t::green_perm = { 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 12, 13, 14, 15 };
|
||||
const rgbaint_t::VECU8 rgbaint_t::blue_perm = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19 };
|
||||
const rgbaint_t::VECU16 rgbaint_t::scale_table[256] = {
|
||||
{ 0, 256, 0, 256, 0, 256, 0, 256 }, { 1, 255, 1, 255, 1, 255, 1, 255 },
|
||||
{ 2, 254, 2, 254, 2, 254, 2, 254 }, { 3, 253, 3, 253, 3, 253, 3, 253 },
|
||||
|
@ -117,25 +117,25 @@ public:
|
||||
inline void set_a(const UINT32 value)
|
||||
{
|
||||
const vector unsigned int temp = { value, 0, 0, 0 };
|
||||
m_value = vec_or(vec_and(m_value, alpha_mask), temp);
|
||||
m_value = vec_perm(m_value, temp, alpha_perm);
|
||||
}
|
||||
|
||||
inline void set_r(const UINT32 value)
|
||||
{
|
||||
const vector unsigned int temp = { 0, value, 0, 0 };
|
||||
m_value = vec_or(vec_and(m_value, red_mask), temp);
|
||||
const vector unsigned int temp = { value, 0, 0, 0 };
|
||||
m_value = vec_perm(m_value, temp, red_perm);
|
||||
}
|
||||
|
||||
inline void set_g(const UINT32 value)
|
||||
{
|
||||
const vector unsigned int temp = { 0, 0, value, 0 };
|
||||
m_value = vec_or(vec_and(m_value, green_mask), temp);
|
||||
const vector unsigned int temp = { value, 0, 0, 0 };
|
||||
m_value = vec_perm(m_value, temp, green_perm);
|
||||
}
|
||||
|
||||
inline void set_b(const UINT32 value)
|
||||
{
|
||||
const vector unsigned int temp = { 0, 0, 0, value };
|
||||
m_value = vec_or(vec_and(m_value, blue_mask), temp);
|
||||
const vector unsigned int temp = { value, 0, 0, 0 };
|
||||
m_value = vec_perm(m_value, temp, blue_perm);
|
||||
}
|
||||
|
||||
inline UINT8 get_a()
|
||||
@ -454,7 +454,7 @@ public:
|
||||
|
||||
inline void merge_alpha(const rgbaint_t& alpha)
|
||||
{
|
||||
m_value = vec_perm(m_value, alpha.m_value, merge_alpha_perm);
|
||||
m_value = vec_perm(m_value, alpha.m_value, alpha_perm);
|
||||
}
|
||||
|
||||
static UINT32 bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v);
|
||||
@ -467,11 +467,10 @@ protected:
|
||||
vector VECU32 m_value;
|
||||
|
||||
static const VECU16 maxbyte;
|
||||
static const VECU32 alpha_mask;
|
||||
static const VECU32 red_mask;
|
||||
static const VECU32 green_mask;
|
||||
static const VECU32 blue_mask;
|
||||
static const VECU8 merge_alpha_perm;
|
||||
static const VECU8 alpha_perm;
|
||||
static const VECU8 red_perm;
|
||||
static const VECU8 green_perm;
|
||||
static const VECU8 blue_perm;
|
||||
static const VECU16 scale_table[256];
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user