Mercurial > repos > blastem
comparison vdp.c @ 1653:858d52140375
Small optimization to render_map
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 27 Dec 2018 10:40:24 -0800 |
parents | d0a69348add8 |
children | 3128d4e0bc68 |
comparison
equal
deleted
inserted
replaced
1652:d0a69348add8 | 1653:858d52140375 |
---|---|
1206 if (col & MAP_BIT_V_FLIP) { | 1206 if (col & MAP_BIT_V_FLIP) { |
1207 address += vflip_base - 4 * context->v_offset; | 1207 address += vflip_base - 4 * context->v_offset; |
1208 } else { | 1208 } else { |
1209 address += 4 * context->v_offset; | 1209 address += 4 * context->v_offset; |
1210 } | 1210 } |
1211 uint16_t pal_priority = (col >> 9) & 0x70; | 1211 uint8_t pal_priority = (col >> 9) & 0x70; |
1212 int32_t dir; | 1212 uint32_t bits = *((uint32_t *)(&context->vdpmem[address])); |
1213 if (col & MAP_BIT_H_FLIP) { | 1213 if (col & MAP_BIT_H_FLIP) { |
1214 offset += 7; | 1214 uint32_t shift = 28; |
1215 offset &= SCROLL_BUFFER_MASK; | 1215 for (int i = 0; i < 8; i++) |
1216 dir = -1; | 1216 { |
1217 } else { | 1217 tmp_buf[offset++] = pal_priority | ((bits >> shift) & 0xF); |
1218 dir = 1; | 1218 shift -= 4; |
1219 } | 1219 offset &= SCROLL_BUFFER_MASK; |
1220 for (uint32_t i=0; i < 4; i++, address++) | 1220 } |
1221 { | 1221 } else { |
1222 tmp_buf[offset] = pal_priority | (context->vdpmem[address] >> 4); | 1222 for (int i = 0; i < 4; i++) |
1223 offset += dir; | 1223 { |
1224 offset &= SCROLL_BUFFER_MASK; | 1224 uint8_t right = pal_priority | (bits & 0xF); |
1225 tmp_buf[offset] = pal_priority | (context->vdpmem[address] & 0xF); | 1225 bits >>= 4; |
1226 offset += dir; | 1226 tmp_buf[offset++] = pal_priority | (bits & 0xF); |
1227 offset &= SCROLL_BUFFER_MASK; | 1227 offset &= SCROLL_BUFFER_MASK; |
1228 bits >>= 4; | |
1229 tmp_buf[offset++] = right; | |
1230 offset &= SCROLL_BUFFER_MASK; | |
1231 } | |
1228 } | 1232 } |
1229 } | 1233 } |
1230 | 1234 |
1231 static void render_map_1(vdp_context * context) | 1235 static void render_map_1(vdp_context * context) |
1232 { | 1236 { |