All pastes #591418 Raw Edit

Miscellany

public text v1 · immutable
#591418 ·published 2007-06-27 06:11 UTC
rendered paste body
#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++;
  }                                                                           
}