all repos — mgba @ dbbe0abaef01f2ad142476002a567ffa9eb1d219

mGBA Game Boy Advance Emulator

Qt: Fix color selection in asset view (fixes #1648)
Vicki Pfau vi@endrift.com
Sun, 26 Jan 2020 13:45:07 -0800
commit

dbbe0abaef01f2ad142476002a567ffa9eb1d219

parent

a6e92b6df779f0eb7fe76109f0b419a2a4bbd960

2 files changed, 4 insertions(+), 3 deletions(-)

jump to
M CHANGESCHANGES

@@ -12,6 +12,7 @@ Other fixes:

- Qt: Only dynamically reset video scale if a game is running - Qt: Fix race condition with proxied video events - Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642) + - Qt: Fix color selection in asset view (fixes mgba.io/i/1648) 0.8.0: (2020-01-21) Features:
M src/platform/qt/AssetTile.cppsrc/platform/qt/AssetTile.cpp

@@ -137,9 +137,9 @@ color_t color = data[index];

m_ui.color->setColor(0, color); m_ui.color->update(); - uint32_t r = M_R8(color); - uint32_t g = M_G8(color); - uint32_t b = M_B8(color); + uint32_t r = ((color & 0xF8) * 0x21) >> 5; + uint32_t g = (((color >> 8) & 0xF8) * 0x21) >> 5; + uint32_t b = (((color >> 16) & 0xF8) * 0x21) >> 5; m_ui.r->setText(tr("0x%0 (%1)").arg(r, 2, 16, QChar('0')).arg(r, 2, 10, QChar('0'))); m_ui.g->setText(tr("0x%0 (%1)").arg(g, 2, 16, QChar('0')).arg(g, 2, 10, QChar('0'))); m_ui.b->setText(tr("0x%0 (%1)").arg(b, 2, 16, QChar('0')).arg(b, 2, 10, QChar('0')));