Anonymous
public text v1 · immutable#define affine_render_scale_wrap(combine_op, alpha_op) \
{ \
u32 wrap_mask = width_height - 1; \
pixel_y = (source_y >> 8) & wrap_mask; \
affine_render_scale_offset(); \
for(i = 0; i < end; i++) \
{ \
pixel_x = (source_x >> 8) & wrap_mask; \
map_offset = (pixel_x / 8); \
if(map_offset != last_map_offset) \
{ \
tile_ptr = tile_base + (map_base[map_offset] * 64); \
last_map_offset = map_offset; \
} \
tile_ptr = tile_base + (map_base[(pixel_x / 8)] * 64); \
current_pixel = tile_ptr[(pixel_x % 8)]; \
tile_8bpp_draw_##combine_op(0, none, 0, alpha_op); \
source_x += dx; \
advance_dest_ptr_##combine_op(1) \
} \
} \
#define affine_render_scale_wrap_new(combine_op, alpha_op) \
{ \
u32 wrap_mask = (width_height / 8) - 1; \
u32 map_x = (source_x >> 11) & wrap_mask; \
s32 tile_x = source_x & 0x7FF; \
\
map_base += ((source_y >> 11) & wrap_mask) << map_pitch; \
tile_base += ((source_y >> 8) % 8) * 8; \
\
tile_ptr = tile_base + (map_base[map_x] * 64); \
\
for(i = 0; i < end; i++) \
{ \
current_pixel = tile_ptr[(tile_x >> 8)]; \
tile_8bpp_draw_##combine_op(0, none, 0, alpha_op); \
\
tile_x += dx; \
\
affine_render_next(combine_op); \
\
if(tile_x & 0xF800) \
{ \
map_x = (map_x + (tile_x >> 11)) & wrap_mask; \
tile_ptr = tile_base + (map_base[map_x] * 64); \
tile_x &= 0x7FF; \
} \
} \
} \