diff options
author | Vas Crabb <vas@vastheman.com> | 2015-06-22 13:54:38 +1000 |
---|---|---|
committer | therealmogminer@gmail.com <therealmogminer@gmail.com> | 2015-06-23 21:02:34 +0200 |
commit | 4c10fcbed2329575f353cf9246518861fb6cf74d (patch) | |
tree | 697872b3ac3c837fa54d890081e009e0b0623d0a | |
parent | c24f99769670f7148555ddcdb08b2a8aa508bfd2 (diff) |
Better than overly literal conversion (nw)
-rw-r--r-- | src/emu/video/rgbvmx.c | 9 | ||||
-rw-r--r-- | src/emu/video/rgbvmx.h | 25 |
2 files changed, 16 insertions, 18 deletions
diff --git a/src/emu/video/rgbvmx.c b/src/emu/video/rgbvmx.c index 094627a9b2d..e7ba9d2a628 100644 --- a/src/emu/video/rgbvmx.c +++ b/src/emu/video/rgbvmx.c @@ -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 }, diff --git a/src/emu/video/rgbvmx.h b/src/emu/video/rgbvmx.h index 9e87997d868..44206aa106f 100644 --- a/src/emu/video/rgbvmx.h +++ b/src/emu/video/rgbvmx.h @@ -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]; }; |