diff --git a/.github/actions/sanity_tests.sh b/.github/actions/sanity_tests.sh index 42dc708..1d8b33e 100755 --- a/.github/actions/sanity_tests.sh +++ b/.github/actions/sanity_tests.sh @@ -16,10 +16,10 @@ set +e FAILED_TESTS=` shasum .github/actions/*.bmp | grep -E -v \(\ -7673e1836eaa28c2967689d0b399f69a597c0c5a\ \ .github/actions/cgb-acid2.bmp\|\ +64c3fd9a5fe9aee40fe15f3371029c0d2f20f5bc\ \ .github/actions/cgb-acid2.bmp\|\ dbcc438dcea13b5d1b80c5cd06bda2592cc5d9e0\ \ .github/actions/cgb_sound.bmp\|\ 0caadf9634e40247ae9c15ff71992e8f77bbf89e\ \ .github/actions/dmg-acid2.bmp\|\ -e3494dcba47af69e8d35fb84c49c272a0d735809\ \ .github/actions/dmg-mode-acid2.bmp\|\ +fbdb5e342bfdd2edda3ea5601d35d0ca60d18034\ \ .github/actions/dmg-mode-acid2.bmp\|\ c9e944b7e01078bdeba1819bc2fa9372b111f52d\ \ .github/actions/dmg_sound-2.bmp\|\ f0172cc91867d3343fbd113a2bb98100074be0de\ \ .github/actions/oam_bug-2.bmp\ \)` diff --git a/Core/display.c b/Core/display.c index d192491..d397e0b 100644 --- a/Core/display.c +++ b/Core/display.c @@ -281,6 +281,7 @@ uint32_t GB_convert_rgb15(GB_gameboy_t *gb, uint16_t color, bool for_border) if (gb->color_correction_mode != GB_COLOR_CORRECTION_CORRECT_CURVES) { uint8_t new_r, new_g, new_b; + if (g != b) { // Minor optimization double gamma = 2.2; if (gb->color_correction_mode < GB_COLOR_CORRECTION_REDUCE_CONTRAST) { /* Don't use absolutely gamma-correct mixing for the high-contrast @@ -290,10 +291,14 @@ uint32_t GB_convert_rgb15(GB_gameboy_t *gb, uint16_t color, bool for_border) // TODO: Optimze pow out using a LUT if (agb) { - new_g = pow((pow(g / 255.0, gamma) * 5 + pow(b / 255.0, gamma)) / 6, 1 / gamma) * 255; + new_g = round(pow((pow(g / 255.0, gamma) * 5 + pow(b / 255.0, gamma)) / 6, 1 / gamma) * 255); } else { - new_g = pow((pow(g / 255.0, gamma) * 3 + pow(b / 255.0, gamma)) / 4, 1 / gamma) * 255; + new_g = round(pow((pow(g / 255.0, gamma) * 3 + pow(b / 255.0, gamma)) / 4, 1 / gamma) * 255); + } + } + else { + new_g = g; } new_r = r;