Merge pull request #3742 from phire/dither
Implement Dithering for video software
This commit is contained in:
commit
1634948b6e
|
@ -391,6 +391,20 @@ namespace EfbInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Dither(u16 x, u16 y, u8 *color)
|
||||||
|
{
|
||||||
|
// No blending for RGB8 mode
|
||||||
|
if (!bpmem.blendmode.dither || bpmem.zcontrol.pixel_format != PEControl::PixelFormat::RGBA6_Z24)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Flipper uses a standard 2x2 Bayer Matrix for 6 bit dithering
|
||||||
|
static const u8 dither[2][2] = {{0, 2}, {3, 1}};
|
||||||
|
|
||||||
|
// Only the color channels are dithered?
|
||||||
|
for (int i = BLU_C; i <= RED_C; i++)
|
||||||
|
color[i] = ((color[i] - (color[i] >> 6)) + dither[y & 1][x & 1]) & 0xfc;
|
||||||
|
}
|
||||||
|
|
||||||
void BlendTev(u16 x, u16 y, u8 *color)
|
void BlendTev(u16 x, u16 y, u8 *color)
|
||||||
{
|
{
|
||||||
u32 dstClr;
|
u32 dstClr;
|
||||||
|
@ -421,6 +435,7 @@ namespace EfbInterface
|
||||||
|
|
||||||
if (bpmem.blendmode.colorupdate)
|
if (bpmem.blendmode.colorupdate)
|
||||||
{
|
{
|
||||||
|
Dither(x, y, dstClrPtr);
|
||||||
if (bpmem.blendmode.alphaupdate)
|
if (bpmem.blendmode.alphaupdate)
|
||||||
SetPixelAlphaColor(offset, dstClrPtr);
|
SetPixelAlphaColor(offset, dstClrPtr);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue