#define affine_render_rotate_wrap(combine_op, alpha_op) { u32 wrap_mask = width_height - 1; for(i = 0; i < end; i++) { pixel_x = (source_x >> 8) & wrap_mask; pixel_y = (source_y >> 8) & wrap_mask; map_offset = (pixel_x / 8) + ((pixel_y / 8) << map_pitch); if(map_offset != last_map_offset) { tile_ptr = tile_base + (map_base[map_offset] * 64); last_map_offset = map_offset; } current_pixel = tile_ptr[(pixel_x % 8) + ((pixel_y % 8) * 8)]; *dest_ptr = palette[current_pixel]; source_x += dx; source_y += dy; dest_ptr++; } }