mirror of https://github.com/mgba-emu/mgba.git
Core: Add RGB8 to native color function
This commit is contained in:
parent
0b0a70d9b7
commit
6174858d0d
|
@ -42,18 +42,24 @@ typedef uint32_t color_t;
|
||||||
#define M_COLOR_BLUE 0x00FF0000
|
#define M_COLOR_BLUE 0x00FF0000
|
||||||
#define M_COLOR_ALPHA 0xFF000000
|
#define M_COLOR_ALPHA 0xFF000000
|
||||||
#define M_COLOR_WHITE 0x00FFFFFF
|
#define M_COLOR_WHITE 0x00FFFFFF
|
||||||
|
|
||||||
|
#define M_RGB8_TO_NATIVE(X) (((X) & 0x00FF00) | (((X) & 0x0000FF) << 16) | (((X) & 0xFF0000) >> 16))
|
||||||
#elif defined(COLOR_5_6_5)
|
#elif defined(COLOR_5_6_5)
|
||||||
#define M_COLOR_RED 0x001F
|
#define M_COLOR_RED 0x001F
|
||||||
#define M_COLOR_GREEN 0x07E0
|
#define M_COLOR_GREEN 0x07E0
|
||||||
#define M_COLOR_BLUE 0xF800
|
#define M_COLOR_BLUE 0xF800
|
||||||
#define M_COLOR_ALPHA 0x0000
|
#define M_COLOR_ALPHA 0x0000
|
||||||
#define M_COLOR_WHITE 0xFFDF
|
#define M_COLOR_WHITE 0xFFDF
|
||||||
|
|
||||||
|
#define M_RGB8_TO_NATIVE(X) ((((X) & 0xF8) << 8) | (((X) & 0xFC00) >> 5) | (((X) & 0xF80000) >> 19))
|
||||||
#else
|
#else
|
||||||
#define M_COLOR_RED 0x001F
|
#define M_COLOR_RED 0x001F
|
||||||
#define M_COLOR_GREEN 0x03E0
|
#define M_COLOR_GREEN 0x03E0
|
||||||
#define M_COLOR_BLUE 0x7C00
|
#define M_COLOR_BLUE 0x7C00
|
||||||
#define M_COLOR_ALPHA 0x1000
|
#define M_COLOR_ALPHA 0x1000
|
||||||
#define M_COLOR_WHITE 0x7FFF
|
#define M_COLOR_WHITE 0x7FFF
|
||||||
|
|
||||||
|
#define M_RGB8_TO_NATIVE(X) M_RGB8_TO_BGR5(X)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PYCPARSE
|
#ifndef PYCPARSE
|
||||||
|
|
|
@ -275,7 +275,7 @@ void FrameView::injectGBA() {
|
||||||
gba->video.renderer->highlightOBJ[i] = false;
|
gba->video.renderer->highlightOBJ[i] = false;
|
||||||
}
|
}
|
||||||
QPalette palette;
|
QPalette palette;
|
||||||
gba->video.renderer->highlightColor = palette.color(QPalette::HighlightedText).rgb();
|
gba->video.renderer->highlightColor = M_RGB8_TO_NATIVE(palette.color(QPalette::Highlight).rgb());
|
||||||
gba->video.renderer->highlightAmount = sin(m_glowFrame * M_PI / 30) * 48 + 64;
|
gba->video.renderer->highlightAmount = sin(m_glowFrame * M_PI / 30) * 48 + 64;
|
||||||
if (!m_overrideBackdrop.isValid()) {
|
if (!m_overrideBackdrop.isValid()) {
|
||||||
QRgb backdrop = M_RGB5_TO_RGB8(gba->video.palette[0]) | 0xFF000000;
|
QRgb backdrop = M_RGB5_TO_RGB8(gba->video.palette[0]) | 0xFF000000;
|
||||||
|
|
Loading…
Reference in New Issue