mirror of https://github.com/mgba-emu/mgba.git
GBA Video, GB Video: Colors are now fully scaled
This commit is contained in:
parent
a86184df43
commit
6c470e3e5c
1
CHANGES
1
CHANGES
|
@ -22,6 +22,7 @@ Misc:
|
|||
- Test: Add a basic test suite
|
||||
- GBA Video: Allow multiple handles into the same tile cache
|
||||
- VFS: Call msync when syncing mapped data
|
||||
- GBA Video, GB Video: Colors are now fully scaled
|
||||
|
||||
0.5.1: (2016-10-05)
|
||||
Bugfixes:
|
||||
|
|
|
@ -32,7 +32,7 @@ static void _clearScreen(struct GBVideoSoftwareRenderer* renderer) {
|
|||
color_t palette0 = 0x7FFF;
|
||||
#endif
|
||||
#else
|
||||
color_t palette0 = 0xF8F8F8;
|
||||
color_t palette0 = 0xFFFFFF;
|
||||
#endif
|
||||
|
||||
int y;
|
||||
|
@ -121,6 +121,7 @@ static void GBVideoSoftwareRendererWritePalette(struct GBVideoRenderer* renderer
|
|||
color |= (value << 3) & 0xF8;
|
||||
color |= (value << 6) & 0xF800;
|
||||
color |= (value << 9) & 0xF80000;
|
||||
color |= (color >> 5) & 0x070707;
|
||||
#endif
|
||||
softwareRenderer->palette[index] = color;
|
||||
if (renderer->cache) {
|
||||
|
|
|
@ -107,6 +107,7 @@ void GBAVideoSoftwareRendererDrawBackgroundMode3(struct GBAVideoSoftwareRenderer
|
|||
color32 |= (color << 3) & 0xF8;
|
||||
color32 |= (color << 6) & 0xF800;
|
||||
color32 |= (color << 9) & 0xF80000;
|
||||
color32 |= (color32 >> 5) & 0x070707;
|
||||
color = color32;
|
||||
#elif COLOR_5_6_5
|
||||
uint16_t color16 = 0;
|
||||
|
@ -196,6 +197,7 @@ void GBAVideoSoftwareRendererDrawBackgroundMode5(struct GBAVideoSoftwareRenderer
|
|||
color32 |= (color << 9) & 0xF80000;
|
||||
color32 |= (color << 3) & 0xF8;
|
||||
color32 |= (color << 6) & 0xF800;
|
||||
color32 |= (color32 >> 5) & 0x070707;
|
||||
color = color32;
|
||||
#elif COLOR_5_6_5
|
||||
uint16_t color16 = 0;
|
||||
|
|
|
@ -237,14 +237,14 @@ static inline unsigned _brighten(unsigned color, int y) {
|
|||
c |= (a + ((0x7C00 - a) * y) / 16) & 0x7C00;
|
||||
#endif
|
||||
#else
|
||||
a = color & 0xF8;
|
||||
c |= (a + ((0xF8 - a) * y) / 16) & 0xF8;
|
||||
a = color & 0xFF;
|
||||
c |= (a + ((0xFF - a) * y) / 16) & 0xFF;
|
||||
|
||||
a = color & 0xF800;
|
||||
c |= (a + ((0xF800 - a) * y) / 16) & 0xF800;
|
||||
a = color & 0xFF00;
|
||||
c |= (a + ((0xFF00 - a) * y) / 16) & 0xFF00;
|
||||
|
||||
a = color & 0xF80000;
|
||||
c |= (a + ((0xF80000 - a) * y) / 16) & 0xF80000;
|
||||
a = color & 0xFF0000;
|
||||
c |= (a + ((0xFF0000 - a) * y) / 16) & 0xFF0000;
|
||||
#endif
|
||||
return c;
|
||||
}
|
||||
|
@ -270,14 +270,14 @@ static inline unsigned _darken(unsigned color, int y) {
|
|||
c |= (a - (a * y) / 16) & 0x7C00;
|
||||
#endif
|
||||
#else
|
||||
a = color & 0xF8;
|
||||
c |= (a - (a * y) / 16) & 0xF8;
|
||||
a = color & 0xFF;
|
||||
c |= (a - (a * y) / 16) & 0xFF;
|
||||
|
||||
a = color & 0xF800;
|
||||
c |= (a - (a * y) / 16) & 0xF800;
|
||||
a = color & 0xFF00;
|
||||
c |= (a - (a * y) / 16) & 0xFF00;
|
||||
|
||||
a = color & 0xF80000;
|
||||
c |= (a - (a * y) / 16) & 0xF80000;
|
||||
a = color & 0xFF0000;
|
||||
c |= (a - (a * y) / 16) & 0xFF0000;
|
||||
#endif
|
||||
return c;
|
||||
}
|
||||
|
@ -320,25 +320,25 @@ static unsigned _mix(int weightA, unsigned colorA, int weightB, unsigned colorB)
|
|||
c = (c & 0x7C1F) | ((c >> 16) & 0x03E0);
|
||||
#endif
|
||||
#else
|
||||
a = colorA & 0xF8;
|
||||
b = colorB & 0xF8;
|
||||
c |= ((a * weightA + b * weightB) / 16) & 0x1F8;
|
||||
a = colorA & 0xFF;
|
||||
b = colorB & 0xFF;
|
||||
c |= ((a * weightA + b * weightB) / 16) & 0x1FF;
|
||||
if (c & 0x00000100) {
|
||||
c = 0x000000F8;
|
||||
c = 0x000000FF;
|
||||
}
|
||||
|
||||
a = colorA & 0xF800;
|
||||
b = colorB & 0xF800;
|
||||
c |= ((a * weightA + b * weightB) / 16) & 0x1F800;
|
||||
a = colorA & 0xFF00;
|
||||
b = colorB & 0xFF00;
|
||||
c |= ((a * weightA + b * weightB) / 16) & 0x1FF00;
|
||||
if (c & 0x00010000) {
|
||||
c = (c & 0x000000F8) | 0x0000F800;
|
||||
c = (c & 0x000000FF) | 0x0000FF00;
|
||||
}
|
||||
|
||||
a = colorA & 0xF80000;
|
||||
b = colorB & 0xF80000;
|
||||
c |= ((a * weightA + b * weightB) / 16) & 0x1F80000;
|
||||
a = colorA & 0xFF0000;
|
||||
b = colorB & 0xFF0000;
|
||||
c |= ((a * weightA + b * weightB) / 16) & 0x1FF0000;
|
||||
if (c & 0x01000000) {
|
||||
c = (c & 0x0000F8F8) | 0x00F80000;
|
||||
c = (c & 0x0000FFFF) | 0x00FF0000;
|
||||
}
|
||||
#endif
|
||||
return c;
|
||||
|
|
|
@ -370,6 +370,7 @@ static void GBAVideoSoftwareRendererWritePalette(struct GBAVideoRenderer* render
|
|||
color |= (value << 3) & 0xF8;
|
||||
color |= (value << 6) & 0xF800;
|
||||
color |= (value << 9) & 0xF80000;
|
||||
color |= (color >> 5) & 0x070707;
|
||||
#endif
|
||||
softwareRenderer->normalPalette[address >> 1] = color;
|
||||
if (softwareRenderer->blendEffect == BLEND_BRIGHTEN) {
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
#define GBA_G5(X) (((X) >> 5) & 0x1F)
|
||||
#define GBA_B5(X) (((X) >> 10) & 0x1F)
|
||||
|
||||
#define GBA_R8(X) (((X) << 3) & 0xF8)
|
||||
#define GBA_G8(X) (((X) >> 2) & 0xF8)
|
||||
#define GBA_B8(X) (((X) >> 7) & 0xF8)
|
||||
#define GBA_R8(X) (((((X) << 3) & 0xF8) * 0x21) >> 5)
|
||||
#define GBA_G8(X) (((((X) >> 2) & 0xF8) * 0x21) >> 5)
|
||||
#define GBA_B8(X) (((((X) >> 7) & 0xF8) * 0x21) >> 5)
|
||||
|
||||
mLOG_DECLARE_CATEGORY(GBA_VIDEO);
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ GameController::GameController(QObject* parent)
|
|||
|
||||
unsigned width, height;
|
||||
controller->m_threadContext.core->desiredVideoDimensions(controller->m_threadContext.core, &width, &height);
|
||||
memset(controller->m_frontBuffer, 0xF8, width * height * BYTES_PER_PIXEL);
|
||||
memset(controller->m_frontBuffer, 0xFF, width * height * BYTES_PER_PIXEL);
|
||||
QMetaObject::invokeMethod(controller, "frameAvailable", Q_ARG(const uint32_t*, controller->m_frontBuffer));
|
||||
if (controller->m_pauseAfterFrame.testAndSetAcquire(true, false)) {
|
||||
mCoreThreadPauseFromThread(context);
|
||||
|
|
|
@ -118,6 +118,7 @@ void PaletteView::selectIndex(int index) {
|
|||
uint32_t g = GBA_G5(color);
|
||||
uint32_t b = GBA_B5(color);
|
||||
uint32_t hexcode = (r << 19) | (g << 11) | (b << 3);
|
||||
hexcode |= (hexcode >> 5) & 0x070707;
|
||||
m_ui.hexcode->setText(tr("#%0").arg(hexcode, 6, 16, QChar('0')));
|
||||
m_ui.value->setText(tr("0x%0").arg(color, 4, 16, QChar('0')));
|
||||
m_ui.index->setText(tr("%0").arg(index, 3, 10, QChar('0')));
|
||||
|
|
Loading…
Reference in New Issue