All pastes #591451 Raw Edit

Anonymous

public text v1 · immutable
#591451 ·published 2007-06-27 06:51 UTC
rendered paste body
#define affine_render_rotate_wrap(combine_op, alpha_op)                       \
{                                                                             \
  u32 wrap_mask = (width_height / 8) - 1;                                     \
  u32 map_x = (source_x >> 11) & wrap_mask;                                   \
  u32 map_y = (source_y >> 11) & wrap_mask;                                   \
                                                                              \
  u32 tile_x = source_x & 0x7FF;                                              \
  u32 tile_y = source_y & 0x7FF;                                              \
                                                                              \
  map_offset = (map_x + (map_y << map_pitch));                                \
  tile_ptr = tile_base + (map_base[map_offset] * 64);                         \
                                                                              \
  for(i = 0; i < end; i++)                                                    \
  {                                                                           \
    pixel_x = tile_x >> 8;                                                    \
    pixel_y = tile_y >> 8;                                                    \
                                                                              \
    current_pixel = tile_ptr[pixel_x + (pixel_y * 8)];                        \
    tile_8bpp_draw_##combine_op(0, none, 0, alpha_op);                        \
                                                                              \
    tile_x += dx;                                                             \
    tile_y += dy;                                                             \
                                                                              \
    affine_render_next(combine_op);                                           \
                                                                              \
    if((tile_x | tile_y) & 0x800)                                             \
    {                                                                         \
      map_x = (map_x + (tile_x >> 11)) & wrap_mask;                           \
      map_y = (map_y + (tile_y >> 11)) & wrap_mask;                           \
      map_offset = (map_x + (map_y << map_pitch));                            \
      tile_ptr = tile_base + (map_base[map_offset] * 64);                     \
      tile_x &= 0x7FF;                                                        \
      tile_y &= 0x7FF;                                                        \
    }                                                                         \
  }                                                                           \
}                                                                             \