aboutsummaryrefslogtreecommitdiffstats
path: root/src/uxn/devices/ppu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/uxn/devices/ppu.c')
-rw-r--r--src/uxn/devices/ppu.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/uxn/devices/ppu.c b/src/uxn/devices/ppu.c
index 0935329..d70afdd 100644
--- a/src/uxn/devices/ppu.c
+++ b/src/uxn/devices/ppu.c
@@ -167,8 +167,8 @@ putpixel(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 color) {
167 size_t tile_y = y / 8; 167 size_t tile_y = y / 8;
168 size_t start_col = x % 8; 168 size_t start_col = x % 8;
169 size_t start_row = y % 8; 169 size_t start_row = y % 8;
170 Uint32 pos = (start_row + ((tile_x + tile_y * 30) * 8)); 170 size_t pos = (start_row + ((tile_x + tile_y * 30) * 8));
171 Uint32 shift = start_col * 4; 171 size_t shift = start_col * 4;
172 layer[pos] = (layer[pos] & (~(0xF << shift))) | (color << shift); 172 layer[pos] = (layer[pos] & (~(0xF << shift))) | (color << shift);
173 dirty_tiles[tile_y] |= 1 << tile_x; 173 dirty_tiles[tile_y] |= 1 << tile_x;
174} 174}
@@ -180,13 +180,16 @@ puticn(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color,
180 size_t tile_y = y / 8; 180 size_t tile_y = y / 8;
181 size_t start_col = x % 8; 181 size_t start_col = x % 8;
182 size_t start_row = y % 8; 182 size_t start_row = y % 8;
183 Uint32 pos = (start_row + ((tile_x + tile_y * 30) * 8)); 183 size_t shift_left = start_col * 4;
184 Uint32 shift_left = start_col * 4; 184 size_t shift_right = (8 - start_col) * 4;
185 Uint32 shift_right = (8 - start_col) * 4;
186 Uint32 *layer_ptr = &layer[pos];
187 if (flipy) flipy = 7;
188 185
189 Uint32 *lut = flipx ? unpack_icon_lut : unpack_icon_lut_flipx; 186 if (flipy) {
187 flipy = 7;
188 }
189
190 size_t pos = (start_row + ((tile_x + tile_y * 30) * 8));
191 size_t *layer_ptr = &layer[pos];
192 size_t *lut = flipx ? unpack_icon_lut : unpack_icon_lut_flipx;
190 193
191 // There are 4 possible cases: 194 // There are 4 possible cases:
192 // 1. The sprite is exactly at the tile boundary. We can just copy the 195 // 1. The sprite is exactly at the tile boundary. We can just copy the