Debian Codegraph @

gba/ppu/mosaic.cpp

raw
1 void PPU::render_mosaic_background(unsigned id) {
2 if(regs.mosaic.bghsize == 0) return;
3 unsigned width = 1 + regs.mosaic.bghsize;
4 auto& buffer = layer[id];
5
6 for(unsigned x = 0; x < 240;) {
7 for(unsigned m = 1; m < width; m++) {
8 if(x + m >= 240) break;
9 buffer[x + m] = buffer[x];
10 }
11 x += width;
12 }
13 }
14
15 void PPU::render_mosaic_object() {
16 if(regs.mosaic.objhsize == 0) return;
17 unsigned width = 1 + regs.mosaic.objhsize;
18 auto& buffer = layer[OBJ];
19
20 Pixel mosaicPixel;
21 mosaicPixel.mosaic = false;
22 unsigned counter = 0;
23
24 for(unsigned x = 0; x < 240; x++) {
25 if(counter == width || mosaicPixel.mosaic == false) {
26 mosaicPixel = buffer[x];
27 if(counter == width) counter = 0;
28 } else {
29 if(buffer[x].mosaic) buffer[x] = mosaicPixel;
30 }
31 counter++;
32 }
33 }