video.cpp - get rid of 'Blend'

This commit is contained in:
twinaphex 2015-02-18 04:04:59 +01:00
parent 09bf141072
commit 686e7af888

View File

@ -38,34 +38,6 @@ namespace gambatte
refreshPalettes();
}
/*static unsigned long gbcToRgb16(const unsigned bgr15) {
const unsigned r = bgr15 & 0x1F;
const unsigned g = bgr15 >> 5 & 0x1F;
const unsigned b = bgr15 >> 10 & 0x1F;
return (((r * 13 + g * 2 + b + 8) << 7) & 0xF800) | ((g * 3 + b + 1) >> 1) << 5 | ((r * 3 + g * 2 + b * 11 + 8) >> 4);
}
static unsigned long gbcToUyvy(const unsigned bgr15) {
const unsigned r5 = bgr15 & 0x1F;
const unsigned g5 = bgr15 >> 5 & 0x1F;
const unsigned b5 = bgr15 >> 10 & 0x1F;
// y = (r5 * 926151 + g5 * 1723530 + b5 * 854319) / 510000 + 16;
// u = (b5 * 397544 - r5 * 68824 - g5 * 328720) / 225930 + 128;
// v = (r5 * 491176 - g5 * 328720 - b5 * 162456) / 178755 + 128;
const unsigned long y = (r5 * 116 + g5 * 216 + b5 * 107 + 16 * 64 + 32) >> 6;
const unsigned long u = (b5 * 225 - r5 * 39 - g5 * 186 + 128 * 128 + 64) >> 7;
const unsigned long v = (r5 * 176 - g5 * 118 - b5 * 58 + 128 * 64 + 32) >> 6;
#ifdef WORDS_BIGENDIAN
return u << 24 | y << 16 | v << 8 | y;
#else
return y << 24 | v << 16 | y << 8 | u;
#endif
}*/
LCD::LCD(const unsigned char *const oamram, const unsigned char *const vram, const VideoInterruptRequester memEventRequester) :
ppu_(nextM0Time_, oamram, vram),
eventTimes_(memEventRequester),
@ -217,22 +189,6 @@ void LCD::refreshPalettes()
}
namespace {
template<unsigned weight>
struct Blend
{
enum { SW = weight - 1 };
#ifdef VIDEO_RGB565
enum { LOWMASK = SW * 0x0821ul };
#else
enum { LOWMASK = SW * 0x010101ul };
#endif
video_pixel_t operator()(const video_pixel_t s, const video_pixel_t d) const
{
return (s * SW + d - (((s & LOWMASK) * SW + (d & LOWMASK)) & LOWMASK)) / weight;
}
};
template<typename T>
static void clear(T *buf, const unsigned long color, const int dpitch)
{