summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
author Ted Green <tedgreen99@protonmail.com>2017-10-01 15:09:02 -0600
committer Ted Green <tedgreen99@protonmail.com>2017-10-01 15:39:53 -0600
commit7d17b6a56984b8ab83b89d30b3fc3129f448294e (patch)
tree38eda817457e0c7c2bcfd88107f1ef3c824c958b /src/lib
parent602c57e10d8c08d1d659c4edf23873dd020cd897 (diff)
voodoo: Use table lookup for RGB565 conversion. (nw)
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/util/palette.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/util/palette.h b/src/lib/util/palette.h
index 27e3fbd00c6..8febfe39764 100644
--- a/src/lib/util/palette.h
+++ b/src/lib/util/palette.h
@@ -48,6 +48,8 @@ public:
constexpr rgb15_t as_rgb15() const { return ((r() >> 3) << 10) | ((g() >> 3) << 5) | ((b() >> 3) << 0); }
constexpr uint8_t brightness() const { return (r() * 222 + g() * 707 + b() * 71) / 1000; }
constexpr uint32_t const *ptr() const { return &m_data; }
+ void expand_rgb(uint8_t &r, uint8_t &g, uint8_t &b) const { r = m_data >> 16; g = m_data >> 8; b = m_data >> 0; }
+ void expand_rgb(int &r, int &g, int &b) const { r = (m_data >> 16) & 0xff; g = (m_data >> 8) & 0xff; b = (m_data >> 0) & 0xff; }
// setters
rgb_t &set_a(uint8_t a) { m_data &= ~0xff000000; m_data |= a << 24; return *this; }