Ignore:
Timestamp:
May 16, 2011, 2:37:27 AM (11 years ago)
Author:
Sam Hocevar
Message:

imlib: started refactoring the dirty rectangle system.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/automap.cpp

    r668 r670  
    2626
    2727  long sx,ex,sy,ey,x,y,window_xstart,window_ystart,
    28                        window_xend,window_yend,centerx,centery,
     28                       window_xend,window_yend,
    2929                       draw_xstart,draw_ystart,
    3030                       i,j;
     
    3838  window_xend=automap_window->x2();
    3939  window_yend=automap_window->y2();
    40   centerx=(window_xstart+window_xend)/2;
    41   centery=(window_ystart+window_yend)/2;
     40  vec2i center((window_xstart+window_xend)/2, (window_ystart+window_yend)/2);
    4241
    4342  sx=x/f_wid-w/2;                // start drawing with this foretile
     
    4847  if (sx<0)                       // does the map scroll past the left side ?
    4948  { sx=0;                         // yes, start drawing at 0
    50     draw_xstart=centerx-(x*AUTOTILE_WIDTH/f_wid);
     49    draw_xstart=center.x-(x*AUTOTILE_WIDTH/f_wid);
    5150  }
    5251  else
    53     draw_xstart=centerx-(x*AUTOTILE_WIDTH/f_wid-sx*AUTOTILE_WIDTH);
     52    draw_xstart=center.x-(x*AUTOTILE_WIDTH/f_wid-sx*AUTOTILE_WIDTH);
    5453
    5554  if (sy<0)
    5655  {
    5756    sy=0;
    58     draw_ystart=centery-(y*AUTOTILE_HEIGHT/f_hi);
     57    draw_ystart=center.y-(y*AUTOTILE_HEIGHT/f_hi);
    5958  }
    6059  else
    61     draw_ystart=centery-(y*AUTOTILE_HEIGHT/f_hi-sy*AUTOTILE_HEIGHT);
     60    draw_ystart=center.y-(y*AUTOTILE_HEIGHT/f_hi-sy*AUTOTILE_HEIGHT);
    6261
    6362  // if view position hasn't changed, only update the blinking dot and return
     
    6564  {
    6665   automap_window->m_surf->Lock();
    67    automap_window->m_surf->AddDirty(centerx,centery,centerx + 1,centery + 1);
     66   automap_window->m_surf->AddDirty(center, center + vec2i(1));
    6867    if ((tick++)&4)
    69       automap_window->m_surf->PutPixel(vec2i(centerx,centery),255);
     68      automap_window->m_surf->PutPixel(center, 255);
    7069    else
    71       automap_window->m_surf->PutPixel(vec2i(centerx,centery),27);
     70      automap_window->m_surf->PutPixel(center, 27);
    7271   automap_window->m_surf->Unlock();
    7372    return ;
     
    9594    ex=foreground_width()-1; */
    9695
    97 
    98 
    99 
    100   // we are going to redraw the whole map, so make the dirty rect work easier by marking
    101   // everything dirty
    102   screen->AddDirty(window_xstart,window_ystart,window_xend+1,window_yend+1);
    103 
    104 
    105 
     96  // we are going to redraw the whole map, so make the dirty rect work
     97  // easier by marking everything dirty
     98  screen->AddDirty(vec2i(window_xstart, window_ystart),
     99                   vec2i(window_xend + 1, window_yend + 1));
    106100
    107101  // draw the tiles that will be around the border of the automap with PutImage
     
    149143  automap_window->m_surf->Lock();
    150144  if ((tick++)&4)
    151     automap_window->m_surf->PutPixel(vec2i(centerx,centery),255);
     145    automap_window->m_surf->PutPixel(center, 255);
    152146  else
    153     automap_window->m_surf->PutPixel(vec2i(centerx,centery),27);
     147    automap_window->m_surf->PutPixel(center, 27);
    154148  automap_window->m_surf->Unlock();
    155149
Note: See TracChangeset for help on using the changeset viewer.