mirror of
https://github.com/libretro/bsnes-libretro.git
synced 2024-11-30 04:20:32 +00:00
d87a0f633d
byuu says: - bsnes: added video filters from bsnes v082 - bsnes: added ZSNES snow effect option when games paused or unloaded (no, I'm not joking) - bsnes: added 7-zip support (LZMA 19.00 SDK) [Recent higan WIPs have also mentioned bsnes changes, although the higan code no longer includes the bsnes code. These changes include: - higan, bsnes: added EXLOROM, EXLOROM-RAM, EXHIROM mappings - higan, bsnes: focus the viewport after leaving fullscreen exclusive mode - bsnes: re-added mightymo's cheat code database - bsnes: improved make install rules for the game and cheat code databases - bsnes: delayed construction of hiro::Window objects to properly show bsnes window icons - Ed.]
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
namespace Filter::Scale2x {
|
|
|
|
auto size(uint& width, uint& height) -> void {
|
|
width *= 2;
|
|
height *= 2;
|
|
}
|
|
|
|
auto render(
|
|
uint32_t* colortable, uint32_t* output, uint outpitch,
|
|
const uint16_t* input, uint pitch, uint width, uint height
|
|
) -> void {
|
|
pitch >>= 1;
|
|
outpitch >>= 2;
|
|
|
|
for(uint y = 0; y < height; y++) {
|
|
const uint16_t* in = input + y * pitch;
|
|
uint32_t* out0 = output + y * outpitch * 2;
|
|
uint32_t* out1 = output + y * outpitch * 2 + outpitch;
|
|
|
|
int prevline = (y == 0 ? 0 : pitch);
|
|
int nextline = (y == height - 1 ? 0 : pitch);
|
|
|
|
for(unsigned x = 0; x < width; x++) {
|
|
uint16_t A = *(in - prevline);
|
|
uint16_t B = (x > 0) ? *(in - 1) : *in;
|
|
uint16_t C = *in;
|
|
uint16_t D = (x < width - 1) ? *(in + 1) : *in;
|
|
uint16_t E = *(in++ + nextline);
|
|
uint32_t c = colortable[C];
|
|
|
|
if(A != E && B != D) {
|
|
*out0++ = (A == B ? colortable[A] : c);
|
|
*out0++ = (A == D ? colortable[A] : c);
|
|
*out1++ = (E == B ? colortable[E] : c);
|
|
*out1++ = (E == D ? colortable[E] : c);
|
|
} else {
|
|
*out0++ = c;
|
|
*out0++ = c;
|
|
*out1++ = c;
|
|
*out1++ = c;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|