Changeset 709


Ignore:
Timestamp:
Aug 17, 2013, 12:01:38 PM (9 years ago)
Author:
Sam Hocevar
Message:

imlib: refactor the image class; no more locks or paging.

Location:
abuse/branches/lol/src
Files:
71 edited

Legend:

Unmodified
Added
Removed
  • abuse/branches/lol/src/ant.cpp

    r695 r709  
    441441
    442442
    443 void fade_in(image *im, int steps);
     443void fade_in(AImage *im, int steps);
    444444void fade_out(int steps);
    445445
     
    451451    wm->SetMousePos(ivec2(0, 0));
    452452    main_screen->clear();
    453     image *im=cache.img(cache.reg("art/frame.spe","end_level_screen",SPEC_IMAGE,1));
     453    AImage *im=cache.img(cache.reg("art/frame.spe","end_level_screen",SPEC_IMAGE,1));
    454454    main_screen->PutImage(im, ivec2(0, 0));
    455455
  • abuse/branches/lol/src/automap.cpp

    r691 r709  
    2323{
    2424  if (!automap_window) return ;
    25   image *screen=automap_window->m_surf;
     25  AImage *screen=automap_window->m_surf;
    2626
    2727  long sx,ex,sy,ey,x,y,window_xstart,window_ystart,
     
    6363  if (draw_xstart==old_dx && draw_ystart==old_dy)
    6464  {
    65    automap_window->m_surf->Lock();
    6665   automap_window->m_surf->AddDirty(center, center + ivec2(1));
    6766    if ((tick++)&4)
     
    6968    else
    7069      automap_window->m_surf->PutPixel(center, 27);
    71    automap_window->m_surf->Unlock();
    7270    return ;
    7371  }
     
    141139  // draw the person as a dot, no need to add a dirty because we marked the
    142140  // whole screen already
    143   automap_window->m_surf->Lock();
    144141  if ((tick++)&4)
    145142    automap_window->m_surf->PutPixel(center, 255);
    146143  else
    147144    automap_window->m_surf->PutPixel(center, 27);
    148   automap_window->m_surf->Unlock();
    149145
    150146  // set the clip back to full window size because soemthing else could mess with the area
  • abuse/branches/lol/src/cache.cpp

    r700 r709  
    199199    case SPEC_FORETILE : delete ((foretile *)i->data);  break;
    200200    case SPEC_BACKTILE : delete ((backtile *)i->data);  break;
    201     case SPEC_IMAGE    : delete ((image *)i->data);     break;
     201    case SPEC_IMAGE    : delete ((AImage *)i->data);     break;
    202202    case SPEC_EXTERN_SFX : delete ((sound_effect *)i->data); break;
    203203    case SPEC_PARTICLE : delete ((part_frame *)i->data); break;
     
    977977}
    978978
    979 image *CacheList::img(int id)
     979AImage *CacheList::img(int id)
    980980{
    981981  CacheItem *me = list + id;
     
    986986  {
    987987    touch(me);
    988     return (image *)me->data;
     988    return (AImage *)me->data;
    989989  }
    990990  else
     
    992992    touch(me);                                           // hold me, feel me, be me!
    993993    locate(me);
    994     image *im=new image(fp);
     994    AImage *im=new AImage(fp);
    995995    me->data=(void *)im;
    996996    last_offset=fp->tell();
    997997
    998     return (image *)me->data;
     998    return (AImage *)me->data;
    999999  }
    10001000}
  • abuse/branches/lol/src/cache.h

    r691 r709  
    117117    foretile *foret(int id);
    118118    figure *fig(int id);
    119     image *img(int id);
     119    AImage *img(int id);
    120120    part_frame *part(int id);
    121121    sound_effect *sfx(int id);
  • abuse/branches/lol/src/cop.cpp

    r708 r709  
    10211021
    10221022
    1023 extern void fade_in(image *im, int steps);
     1023extern void fade_in(AImage *im, int steps);
    10241024extern void fade_out(int steps);
    10251025
     
    10291029  wm->SetMousePos(ivec2(0, 0));
    10301030  main_screen->clear();
    1031   image *im=cache.img(cache.reg("art/frame.spe","end_level_screen",SPEC_IMAGE,1));
     1031  AImage *im=cache.img(cache.reg("art/frame.spe","end_level_screen",SPEC_IMAGE,1));
    10321032  main_screen->PutImage(im, ivec2(0, 0));
    10331033  int x1=im->Size().x+1,y1=0,y2=main_screen->Size().y;
  • abuse/branches/lol/src/demo.cpp

    r707 r709  
    3535extern void net_receive();
    3636extern void net_send(int force);
    37 extern void fade_in(image *im, int steps);
     37extern void fade_in(AImage *im, int steps);
    3838extern void fade_out(int steps);
    3939
  • abuse/branches/lol/src/dev.cpp

    r708 r709  
    104104  public :
    105105  cached_image(int Id) { id=Id; }
    106   virtual void draw(image *screen, int x, int y, Filter *f)
     106  virtual void draw(AImage *screen, int x, int y, Filter *f)
    107107  {
    108108    if (f)
     
    144144  amb_cont(int X, int Y, ifield *Next) : scroller(X,Y,ID_NULL,100,wm->font()->Size().y+2,0,64,Next)
    145145  { if (player_list) sx=player_list->ambient; }
    146   virtual void scroll_event(int newx, image *screen)
     146  virtual void scroll_event(int newx, AImage *screen)
    147147  {
    148148    screen->Bar(m_pos, m_pos + ivec2(l - 1, h - 1), wm->dark_color());
     
    160160{
    161161    Jwindow *quitw;
    162     image *ok_image, *cancel_image;
     162    AImage *ok_image, *cancel_image;
    163163
    164164    ok_image = cache.img(cache.reg("art/frame.spe", "dev_ok",
     
    351351}
    352352
    353 void scale_put(image *im, image *screen, int x, int y, short new_width, short new_height)
     353void scale_put(AImage *im, AImage *screen, int x, int y, short new_width, short new_height)
    354354{
    355355  unsigned char *sl1,*sl2;
     
    378378    new_height-=y+new_height-cbb.y;
    379379
    380   screen->Lock();
    381   im->Lock();
    382380  for (iy=iy_start; new_height>0; new_height--,y++,iy+=ystep)
    383381  {
     
    387385      *sl2=sl1[ix>>16];
    388386  }
    389   im->Unlock();
    390   screen->Unlock();
    391 }
    392 
    393 
    394 void scale_put_trans(image *im, image *screen, int x, int y, short new_width, short new_height)
     387}
     388
     389
     390void scale_put_trans(AImage *im, AImage *screen, int x, int y, short new_width, short new_height)
    395391{
    396392  unsigned char *sl1,*sl2;
     
    420416
    421417  uint8_t d;
    422   screen->Lock();
    423418  for (iy=iy_start; new_height>0; new_height--,y++,iy+=ystep)
    424419  {
     
    432427    }
    433428  }
    434   screen->Unlock();
    435429}
    436430
     
    468462             && f->m_pos.y - dv.y <= (v->m_bb.y - v->m_aa.y + 1))
    469463        {
    470           image *im = cache.img(light_buttons[f->m_type]);
     464          AImage *im = cache.img(light_buttons[f->m_type]);
    471465          main_screen->PutImage(im, f->m_pos - dv + v->m_aa - im->Size() / 2);
    472466          main_screen->Rectangle(f->m_p1 - dv + v->m_aa, f->m_p2 - dv + v->m_aa,
     
    484478    if (selected_light)
    485479    {
    486       image *im = cache.img(light_buttons[0]);
     480      AImage *im = cache.img(light_buttons[0]);
    487481      ivec2 pos = the_game->GameToMouse(selected_light->m_pos, v);
    488482      main_screen->Rectangle(pos - im->Size() / 2, pos + im->Size() / 2,
     
    541535static LightSource *find_light(int32_t x, int32_t y)
    542536{
    543   image *i = cache.img(light_buttons[0]);
     537  AImage *i = cache.img(light_buttons[0]);
    544538  int l = i->Size().x / 2, h = i->Size().y / 2;
    545539  for (LightSource *f = first_light_source; f; f = f->m_next)
     
    29312925  {
    29322926    me->clear();
    2933     image *im=new image(ivec2(the_game->ftile_width(),the_game->ftile_height()));
     2927    AImage *im=new AImage(ivec2(the_game->ftile_width(),the_game->ftile_height()));
    29342928    int th=the_game->ftile_height()/scale,tw=the_game->ftile_width()/scale;
    29352929
  • abuse/branches/lol/src/devsel.cpp

    r682 r709  
    2020#include "game.h"
    2121
    22 void scale_put(image *im, image *screen, int x, int y, short new_width, short new_height);
    23 void scale_put_trans(image *im, image *screen, int x, int y, short new_width, short new_height);
     22void scale_put(AImage *im, AImage *screen, int x, int y, short new_width, short new_height);
     23void scale_put_trans(AImage *im, AImage *screen, int x, int y, short new_width, short new_height);
    2424int cur_bg=0,cur_fg=0,cur_char=0;
    2525
    26 void tile_picker::recenter(image *screen)
     26void tile_picker::recenter(AImage *screen)
    2727{
    2828  set_x(get_current(), screen);
     
    9191
    9292
    93 void tile_picker::scroll_event(int newx, image *screen)
     93void tile_picker::scroll_event(int newx, AImage *screen)
    9494{
    9595  int ya = pich(), xw = picw(), c = get_current();
    96   image im(ivec2(xw, ya));
     96  AImage im(ivec2(xw, ya));
    9797  last_sel=newx;
    9898
     
    147147
    148148
    149 void tile_picker::handle_inside_event(Event &ev, image *screen, InputManager *inm)
     149void tile_picker::handle_inside_event(Event &ev, AImage *screen, InputManager *inm)
    150150{
    151151  if (ev.type==EV_MOUSE_BUTTON)
  • abuse/branches/lol/src/devsel.h

    r643 r709  
    1919  tile_picker(int X, int Y, int ID, int spec_type,
    2020         int scale, int scroll_h, int Wid, ifield *Next);
    21   virtual void handle_inside_event(Event &ev, image *screen, InputManager *inm);
    22   virtual void scroll_event(int newx, image *screen);
     21  virtual void handle_inside_event(Event &ev, AImage *screen, InputManager *inm);
     22  virtual void scroll_event(int newx, AImage *screen);
    2323  virtual char *read() { return (char *)this; }
    2424  int picw();
     
    2727  int get_current();
    2828  void set_current(int x);
    29   void recenter(image *screen);
     29  void recenter(AImage *screen);
    3030  void reverse() { rev=!rev; }
    3131} ;
  • abuse/branches/lol/src/endgame.cpp

    r707 r709  
    4343extern int text_draw(int y, int x1, int y1, int x2, int y2, char const *buf, JCFont *font, uint8_t *cmap, char color);
    4444
    45 static mask_line *make_mask_lines(image *mask, int map_width)
     45static mask_line *make_mask_lines(AImage *mask, int map_width)
    4646{
    4747  mask_line *p=(mask_line *)malloc(mask->Size().y*sizeof(mask_line));
     
    8484
    8585
    86 void scan_map(image *screen, int sx, int sy, image *im1, image *im2, int fade256, int32_t *paddr, mask_line *p, int mask_height,
     86void scan_map(AImage *screen, int sx, int sy, AImage *im1, AImage *im2, int fade256, int32_t *paddr, mask_line *p, int mask_height,
    8787          int xoff, int coff)
    8888{
     
    131131
    132132
    133 void fade_in(image *im, int steps);
     133void fade_in(AImage *im, int steps);
    134134void fade_out(int steps);
    135135
     
    142142} ;
    143143
    144 void scale_put      (image *im, image *screen, int x, int y, short new_width, short new_height);
    145 void scale_put_trans(image *im, image *screen, int x, int y, short new_width, short new_height);
     144void scale_put      (AImage *im, AImage *screen, int x, int y, short new_width, short new_height);
     145void scale_put_trans(AImage *im, AImage *screen, int x, int y, short new_width, short new_height);
    146146
    147147void show_end2()
     
    179179  fade_out(16);
    180180
    181   image blank(ivec2(2)); blank.clear();
     181  AImage blank(ivec2(2)); blank.clear();
    182182  wm->SetMouseShape(blank.copy(), ivec2(0, 0));      // don't show mouse
    183183
     
    220220
    221221  scan_map(main_screen,ex,ey,cache.img(planet),cache.img(planet2),0,paddr,p,cache.img(mask)->Size().y,eoff,coff);
    222   image *tcopy=cache.img(planet)->copy();
     222  AImage *tcopy=cache.img(planet)->copy();
    223223  fade_in(NULL,32);
    224224
     
    256256      {
    257257    int t=i-38;
    258     image *s=cache.img(ship);
     258    AImage *s=cache.img(ship);
    259259    int nw=s->Size().x*(t+2)/16,
    260260        nh=s->Size().y*(t+2)/16;
     
    424424{
    425425  fade_out(16);
    426   image blank(ivec2(2, 2)); blank.clear();
     426  AImage blank(ivec2(2, 2)); blank.clear();
    427427  wm->SetMouseShape(blank.copy(), ivec2(0, 0)); // don't show mouse
    428428  main_screen->clear();
    429429
    430   image *im=cache.img(cache.reg("art/fore/endgame.spe","tbc",SPEC_IMAGE,1));
     430  AImage *im=cache.img(cache.reg("art/fore/endgame.spe","tbc",SPEC_IMAGE,1));
    431431
    432432  void *to_be = LSymbol::FindOrCreate("to_be_continued")->GetValue();
     
    481481{
    482482  fade_out(16);
    483   image blank(ivec2(2, 2)); blank.clear();
     483  AImage blank(ivec2(2, 2)); blank.clear();
    484484  wm->SetMouseShape(blank.copy(), ivec2(0, 0));      // don't show mouse
    485485  main_screen->clear();
    486486
    487   image *im=cache.img(cache.reg("art/fore/endgame.spe","end.pcx",SPEC_IMAGE,1));
     487  AImage *im=cache.img(cache.reg("art/fore/endgame.spe","end.pcx",SPEC_IMAGE,1));
    488488
    489489  int dx=(xres+1)/2-320/2,dy=(yres+1)/2-200/2;
  • abuse/branches/lol/src/game.cpp

    r708 r709  
    439439        if(but) but = 1;
    440440        int dx = 20, dy = 5;
    441         image *jim = cache.img(joy_picts[but * 9+(y + 1)*3 + x + 1]);
     441        AImage *jim = cache.img(joy_picts[but * 9+(y + 1)*3 + x + 1]);
    442442        joy_win->m_surf->Bar(ivec2(dx, dy), ivec2(dx + jim->Size().x + 6,
    443443                                                  dy + jim->Size().y + 6),
     
    477477}
    478478
    479 void Game::draw_value(image *screen, int x, int y, int w, int h,
     479void Game::draw_value(AImage *screen, int x, int y, int w, int h,
    480480                      int val, int max)
    481481{
     
    599599}
    600600
    601 void remap_area(image *screen, int x1, int y1, int x2, int y2, uint8_t *remap)
    602 {
    603     screen->Lock();
    604 
     601void remap_area(AImage *screen, int x1, int y1, int x2, int y2, uint8_t *remap)
     602{
    605603    uint8_t *sl = (uint8_t *)screen->scan_line(y1) + x1;
    606604    int step = screen->Size().x - (x2 - x1 + 1);
     
    615613        sl += step;
    616614    }
    617     screen->Unlock();
    618615}
    619616
     
    643640      if(state == SCENE_STATE)
    644641        main_screen->SetClip(v->m_aa, v->m_bb + ivec2(1));
    645       image *tit = cache.img(title_screen);
     642      AImage *tit = cache.img(title_screen);
    646643      main_screen->PutImage(tit, main_screen->Size() / 2 - tit->Size() / 2);
    647644      if(state == SCENE_STATE)
     
    663660  {
    664661    int c = v->draw_solid;
    665     main_screen->Lock();
    666662    for(int y = v->m_aa.y; y <= v->m_bb.y; y++)
    667663      memset(main_screen->scan_line(y)+v->m_aa.x, c, v->m_bb.x - v->m_aa.x + 1);
    668     main_screen->Unlock();
    669664    v->draw_solid = -1;
    670665    return;
     
    799794      else
    800795        main_screen->clear(wm->black());
    801       main_screen->Lock();
    802796      for(y = y1, draw_y = yo; y <= y2; y++, draw_y += yinc)
    803797      {
     
    824818    }
    825819      }
    826       main_screen->Unlock();
    827820
    828821      if(dev & EDIT_MODE)
     
    10411034}
    10421035
    1043 template<int N> static void Fade(image *im, int steps)
     1036template<int N> static void Fade(AImage *im, int steps)
    10441037{
    10451038    /* 25ms per step */
     
    10791072}
    10801073
    1081 void fade_in(image *im, int steps)
     1074void fade_in(AImage *im, int steps)
    10821075{
    10831076    Fade<1>(im, steps);
     
    11161109    // exit() will try to delete (through the desctructor of
    11171110    // image_list in image.cpp) the image on the stack -> boom.
    1118     image *blank = new image(ivec2(2, 2));
     1111    AImage *blank = new AImage(ivec2(2, 2));
    11191112    blank->clear();
    11201113    wm->SetMouseShape(blank->copy(), ivec2(0, 0)); // hide mouse
     
    11351128        g_palette->shift(1);
    11361129
    1137         image *gray = new image(fp, sd.find("gray_pict"));
    1138         image *smoke[5];
     1130        AImage *gray = new AImage(fp, sd.find("gray_pict"));
     1131        AImage *smoke[5];
    11391132
    11401133        char nm[20];
     
    11421135        {
    11431136            sprintf(nm, "smoke%04d.pcx", i + 1);
    1144             smoke[i] = new image(fp, sd.find(nm));
     1137            smoke[i] = new AImage(fp, sd.find(nm));
    11451138        }
    11461139
     
    13611354    if(title_screen >= 0)
    13621355    {
    1363       image *im = cache.img(title_screen);
     1356      AImage *im = cache.img(title_screen);
    13641357      main_screen->PutImage(im, main_screen->Size() / 2 - im->Size() / 2);
    13651358    }
  • abuse/branches/lol/src/game.h

    r698 r709  
    9494  void step();
    9595  void show_help(char const *st);
    96   void draw_value(image *screen, int x, int y, int w, int h, int val, int max);
     96  void draw_value(AImage *screen, int x, int y, int w, int h, int val, int max);
    9797  unsigned char get_color(int x) { return x; }
    9898  int done();
  • abuse/branches/lol/src/gamma.cpp

    r708 r709  
    3434public:
    3535    int sc;
    36     virtual void draw_item(image *screen, int x, int y, int num, int active)
     36    virtual void draw_item(AImage *screen, int x, int y, int num, int active)
    3737    {
    3838        long x2 = x + item_width() - 1;
  • abuse/branches/lol/src/gui.cpp

    r707 r709  
    7474}
    7575
    76 void ico_switch_button::handle_event(Event &ev, image *screen, InputManager *im)
     76void ico_switch_button::handle_event(Event &ev, AImage *screen, InputManager *im)
    7777{
    7878  if ((ev.type==EV_KEY && ev.key==13) || (ev.type==EV_MOUSE_BUTTON &&
     
    8787}
    8888
    89 void ico_button::draw(int active, image *screen)
     89void ico_button::draw(int active, AImage *screen)
    9090{
    9191    int x1, y1, x2, y2;
     
    119119extern int sfx_volume;
    120120
    121 void ico_button::handle_event(Event &ev, image *screen, InputManager *im)
     121void ico_button::handle_event(Event &ev, AImage *screen, InputManager *im)
    122122{
    123123  if ((ev.type==EV_KEY && ev.key==13) || (ev.type==EV_MOUSE_BUTTON &&
  • abuse/branches/lol/src/gui.h

    r698 r709  
    2323
    2424  virtual void area(int &x1, int &y1, int &x2, int &y2);
    25   virtual void draw_first(image *screen) { draw(0,screen); }
    26   virtual void draw(int active, image *screen);
    27   virtual void handle_event(Event &ev, image *screen, InputManager *im);
     25  virtual void draw_first(AImage *screen) { draw(0,screen); }
     26  virtual void draw(int active, AImage *screen);
     27  virtual void handle_event(Event &ev, AImage *screen, InputManager *im);
    2828
    2929  virtual char *read() { return (char *)&up; }
     
    3939  ico_switch_button(int X, int Y, int ID, int start_on, ifield *butts, ifield *Next);
    4040  virtual void area(int &x1, int &y1, int &x2, int &y2);
    41   virtual void draw_first(image *screen) { cur_but->draw_first(screen); }
    42   virtual void draw(int active, image *screen) { cur_but->draw(active,screen); act=active; }
    43   virtual void handle_event(Event &ev, image *screen, InputManager *im);
     41  virtual void draw_first(AImage *screen) { cur_but->draw_first(screen); }
     42  virtual void draw(int active, AImage *screen) { cur_but->draw(active,screen); act=active; }
     43  virtual void handle_event(Event &ev, AImage *screen, InputManager *im);
    4444  virtual ifield *unlink(int id);
    4545  virtual char *read() { return cur_but->read(); }
  • abuse/branches/lol/src/help.cpp

    r682 r709  
    2323static int help_page=0;
    2424
    25 void fade_in(image *im, int steps);
     25void fade_in(AImage *im, int steps);
    2626void fade_out(int steps);
    2727
    2828void draw_help()
    2929{
    30   image *im=cache.img(help_screens[help_page]);
     30  AImage *im=cache.img(help_screens[help_page]);
    3131  int x1=xres/2-im->Size().x/2,y1=yres/2-im->Size().y/2;
    3232  int x2=x1+im->Size().x,y2=y1+im->Size().y;
  • abuse/branches/lol/src/imlib/event.cpp

    r707 r709  
    3232// Constructor
    3333//
    34 EventHandler::EventHandler(image *screen, Palette *pal)
     34EventHandler::EventHandler(AImage *screen, Palette *pal)
    3535{
    3636    ASSERT(screen);
     
    5858    f.Set(1, pal->FindBrightest(1));
    5959    f.Set(2, pal->FindDarkest(1));
    60     image *im = new image(ivec2(8, 10), mouse_sprite);
     60    AImage *im = new AImage(ivec2(8, 10));
     61    memcpy(im->scan_line(0), mouse_sprite, 8 * 10);
    6162    f.Apply(im);
    6263
     
    6566    m_center = ivec2(0, 0);
    6667    m_button = 0;
    67 
    68     // Platform-specific stuff
    69     SysInit();
    7068}
    7169
  • abuse/branches/lol/src/imlib/event.h

    r707 r709  
    6161{
    6262public:
    63     EventHandler(image *screen, Palette *pal);
     63    EventHandler(AImage *screen, Palette *pal);
    6464    ~EventHandler();
    6565
     
    7979
    8080  int has_mouse() { return 1; }
    81     void SetMouseShape(image *im, ivec2 center)
     81    void SetMouseShape(AImage *im, ivec2 center)
    8282    {
    8383        m_sprite->SetVisual(im, 1);
     
    9595    int m_pending, last_key;
    9696
    97     image *m_screen;
     97    AImage *m_screen;
    9898
    9999protected:
  • abuse/branches/lol/src/imlib/filesel.cpp

    r682 r709  
    3232  virtual int item_width() { return wm->font()->Size().x * wid; }
    3333  virtual int item_height() { return wm->font()->Size().y + 1; }
    34   virtual void draw_item(image *screen, int x, int y, int num, int active);
    35   virtual void note_selection(image *screen, InputManager *inm, int x);
     34  virtual void draw_item(AImage *screen, int x, int y, int num, int active);
     35  virtual void note_selection(AImage *screen, InputManager *inm, int x);
    3636  void free_up();
    3737  ~file_picker() { free_up(); }
     
    4949}
    5050
    51 void file_picker::note_selection(image *screen, InputManager *inm, int x)
     51void file_picker::note_selection(AImage *screen, InputManager *inm, int x)
    5252{
    5353  if (x<td)
     
    9393}
    9494
    95 void file_picker::draw_item(image *screen, int x, int y, int num, int active)
     95void file_picker::draw_item(AImage *screen, int x, int y, int num, int active)
    9696{
    9797    if (active)
  • abuse/branches/lol/src/imlib/filter.cpp

    r694 r709  
    5757}
    5858
    59 void Filter::Apply(image *im)
     59void Filter::Apply(AImage *im)
    6060{
    61     im->Lock();
    6261    uint8_t *dst = im->scan_line(0);
    6362    int npixels = im->Size().x * im->Size().y;
     
    6766        ++dst;
    6867    }
    69     im->Unlock();
    7068}
    7169
    7270/* This is only ever used in the editor, when showing the toolbar. It
    7371 * does not look like it's very useful. */
    74 void Filter::PutImage(image *screen, image *im, ivec2 pos)
     72void Filter::PutImage(AImage *screen, AImage *im, ivec2 pos)
    7573{
    7674    ivec2 aa = ivec2(0), bb = im->Size(), caa, cbb;
     
    9290    screen->AddDirty(pos, pos + span);
    9391
    94     screen->Lock();
    95     im->Lock();
    96 
    9792    for (int j = 0; j < span.y; j++)
    9893    {
     
    10499                *dst = m_table[*src];
    105100    }
    106 
    107     im->Unlock();
    108     screen->Unlock();
    109101}
    110102
  • abuse/branches/lol/src/imlib/filter.h

    r694 r709  
    2525    void Set(int color_num, int change_to);
    2626    int GetMapping(int color_num) { return m_table[color_num]; }
    27     void Apply(image *im);
    28     void PutImage(image *screen, image *im, ivec2 pos);
     27    void Apply(AImage *im);
     28    void PutImage(AImage *screen, AImage *im, ivec2 pos);
    2929
    3030private:
  • abuse/branches/lol/src/imlib/fonts.cpp

    r682 r709  
    1919#include "fonts.h"
    2020
    21 void JCFont::PutString(image *screen, ivec2 pos, char const *st, int color)
     21void JCFont::PutString(AImage *screen, ivec2 pos, char const *st, int color)
    2222{
    2323    for ( ; *st; st++, pos.x += m_size.x)
     
    2525}
    2626
    27 void JCFont::PutChar(image *screen, ivec2 pos, char ch, int color)
     27void JCFont::PutChar(AImage *screen, ivec2 pos, char ch, int color)
    2828{
    2929    if (!m_data[(int)ch])
     
    3636}
    3737
    38 JCFont::JCFont(image *letters)
     38JCFont::JCFont(AImage *letters)
    3939{
    4040    m_size = (letters->Size() + ivec2(1)) / ivec2(32, 8);
    4141
    42     image tmp(m_size);
     42    AImage tmp(m_size);
    4343
    4444    for (int ch = 0; ch < 256; ch++)
  • abuse/branches/lol/src/imlib/fonts.h

    r682 r709  
    1818{
    1919public:
    20     JCFont(image *letters);
     20    JCFont(AImage *letters);
    2121    ~JCFont();
    2222
    23     void PutChar(image *screen, ivec2 pos, char ch, int color = -1);
    24     void PutString(image *screen, ivec2 pos, char const *st, int color = -1);
     23    void PutChar(AImage *screen, ivec2 pos, char ch, int color = -1);
     24    void PutString(AImage *screen, ivec2 pos, char const *st, int color = -1);
    2525    ivec2 Size() const { return m_size; }
    2626
  • abuse/branches/lol/src/imlib/image.cpp

    r708 r709  
    2222linked_list image_list; // FIXME: only jwindow.cpp needs this
    2323
    24 image_descriptor::image_descriptor(ivec2 size,
    25                                    int keep_dirties, int static_memory)
     24image_descriptor::image_descriptor(ivec2 size, int keep_dirties)
    2625{
    2726    m_aa = ivec2(0);
     
    3029
    3130    keep_dirt = keep_dirties;
    32     static_mem = static_memory;
    33 }
    34 
    35 void image::SetSize(ivec2 new_size, uint8_t *page)
    36 {
    37     DeletePage();
    38     m_size = new_size;
    39     MakePage(new_size, page);
    40 }
    41 
    42 void image::MakePage(ivec2 size, uint8_t *page_buffer)
    43 {
    44     m_data = page_buffer ? page_buffer : (uint8_t *)malloc(size.x * size.y);
    45 }
    46 
    47 void image::DeletePage()
    48 {
    49     if (!m_special || !m_special->static_mem)
    50         free(m_data);
    51 }
    52 
    53 image::~image()
    54 {
    55     if(m_locked)
    56     {
    57         fprintf(stderr, "Error: image is locked upon deletion\n");
    58         Unlock();
    59     }
    60 
     31}
     32
     33void AImage::SetSize(ivec2 size)
     34{
     35    m_size = size;
     36    m_data.Resize(m_size.x * m_size.y);
     37}
     38
     39AImage::~AImage()
     40{
    6141    image_list.unlink(this);
    62     DeletePage();
    6342    delete m_special;
    6443}
    6544
    66 uint8_t image::Pixel(ivec2 pos)
     45uint8_t AImage::Pixel(ivec2 pos)
    6746{
    6847    ASSERT(pos.x >= 0 && pos.x < m_size.x && pos.y >= 0 && pos.y < m_size.y,
    69            "image::Pixel Bad pixel xy");
     48           "AImage::Pixel Bad pixel xy");
    7049    return scan_line(pos.y)[pos.x];
    7150}
    7251
    73 void image::PutPixel(ivec2 pos, uint8_t color)
     52void AImage::PutPixel(ivec2 pos, uint8_t color)
    7453{
    7554    ASSERT(pos.x >= 0 && pos.x < m_size.x && pos.y >= 0 && pos.y < m_size.y,
    76            "image::PutPixel Bad pixel xy");
     55           "AImage::PutPixel Bad pixel xy");
    7756
    7857    if (m_special &&
     
    8463}
    8564
    86 
    87 image::image(ivec2 size, uint8_t *page_buffer, int create_descriptor)
     65AImage::AImage(ivec2 size, int create_descriptor)
    8866{
    8967    m_size = size;
    9068    m_special = NULL;
    91     if (create_descriptor || page_buffer)
    92         m_special = new image_descriptor(size, create_descriptor == 2,
    93                                          (page_buffer != NULL));
    94     MakePage(size, page_buffer);
     69    m_data.Resize(m_size.x * m_size.y);
     70    if (create_descriptor)
     71        m_special = new image_descriptor(size, create_descriptor == 2);
    9572    image_list.add_end(this);
    96     m_locked = false;
    97 }
    98 
    99 image::image(bFILE *fp, SpecEntry *e /* = NULL */)
     73}
     74
     75AImage::AImage(bFILE *fp, SpecEntry *e /* = NULL */)
    10076{
    10177    if (e)
     
    10480    m_size.y = fp->read_uint16();
    10581    m_special = NULL;
    106     MakePage(m_size, NULL);
     82    m_data.Resize(m_size.x * m_size.y);
    10783    for (int i = 0; i < m_size.y; i++)
    10884        fp->read(scan_line(i), m_size.x);
    10985    image_list.add_end(this);
    110     m_locked = false;
    111 }
    112 
    113 void image::Lock()
    114 {
    115     /* This is currently a no-op, because it's unneeded with SDL */
    116 
    117     if(m_locked)
    118         fprintf(stderr, "Trying to lock a locked picture!\n");
    119     m_locked = true;
    120 }
    121 
    122 void image::Unlock()
    123 {
    124     /* This is currently a no-op, because it's unneeded with SDL */
    125 
    126     if(!m_locked)
    127         fprintf(stderr, "Trying to unlock an unlocked picture!\n");
    128     m_locked = false;
    12986}
    13087
     
    13390    while (image_list.first())
    13491    {
    135         image *im = (image *)image_list.first();
     92        AImage *im = (AImage *)image_list.first();
    13693        image_list.unlink(im);
    13794        delete im;
     
    145102}
    146103
    147 void image::clear(int color)
    148 {
    149     Lock();
     104void AImage::clear(int color)
     105{
    150106    if(color == -1)
    151107        color = 0; // transparent
     
    161117            memset(scan_line(j), color, m_size.x);
    162118    AddDirty(ivec2(0), m_size);
    163     Unlock();
    164 }
    165 
    166 image *image::copy()
    167 {
    168     Lock();
    169     image *im = new image(m_size);
    170     im->Lock();
     119}
     120
     121AImage *AImage::copy()
     122{
     123    AImage *im = new AImage(m_size);
    171124    for(int j = 0; j < m_size.y; j++)
    172125        memcpy(im->scan_line(j), scan_line(j), m_size.x);
    173     im->Unlock();
    174     Unlock();
    175126    return im;
    176127}
     
    179130// Draw a line of the given colour on the image. Both endpoints are set.
    180131//
    181 void image::Line(ivec2 p1, ivec2 p2, uint8_t color)
     132void AImage::Line(ivec2 p1, ivec2 p2, uint8_t color)
    182133{
    183134    // check to see if the line is completly clipped off
     
    232183    int ery = 2 * lol::min(span.x * xi, span.y * yi);
    233184
    234     Lock();
    235185    for (int i = 0, er = 0; i <= lol::max(n, m); i++)
    236186    {
     
    244194        start += dy;
    245195    }
    246     Unlock();
    247 }
    248 
    249 
    250 void image::PutImage(image *im, ivec2 pos, int transparent)
     196}
     197
     198
     199void AImage::PutImage(AImage *im, ivec2 pos, int transparent)
    251200{
    252201    PutPart(im, pos, ivec2(0), im->m_size, transparent);
    253202}
    254203
    255 void image::PutPart(image *im, ivec2 pos, ivec2 aa, ivec2 bb, int transparent)
     204void AImage::PutPart(AImage *im, ivec2 pos, ivec2 aa, ivec2 bb, int transparent)
    256205{
    257206    ASSERT(aa < bb);
     
    283232    AddDirty(pos, pos + span);
    284233
    285     Lock();
    286     im->Lock();
    287 
    288234    for (int j = 0; j < span.y; j++)
    289235    {
     
    299245            memcpy(dst, src, span.x);
    300246    }
    301 
    302     im->Unlock();
    303     Unlock();
    304 }
    305 
    306 void image::Rectangle(ivec2 p1, ivec2 p2, uint8_t color)
     247}
     248
     249void AImage::Rectangle(ivec2 p1, ivec2 p2, uint8_t color)
    307250{
    308251    Line(p1, ivec2(p2.x, p1.y), color);
     
    312255}
    313256
    314 void image::SetClip(ivec2 aa, ivec2 bb)
    315 {
    316     // If the image does not already have an Image descriptor, allocate one
     257void AImage::SetClip(ivec2 aa, ivec2 bb)
     258{
     259    // If the image does not already have an AImage descriptor, allocate one
    317260    // with no dirty rectangle keeping.
    318261    if (!m_special)
     
    324267}
    325268
    326 void image::GetClip(ivec2 &aa, ivec2 &bb)
     269void AImage::GetClip(ivec2 &aa, ivec2 &bb)
    327270{
    328271    if (m_special)
     
    335278}
    336279
    337 void image::InClip(ivec2 aa, ivec2 bb)
     280void AImage::InClip(ivec2 aa, ivec2 bb)
    338281{
    339282    if (m_special)
     
    346289}
    347290
    348 void image::SetClip(int x1, int y1, int x2, int y2)
    349 {
    350    // If the image does not already have an Image descriptor, allocate one
     291void AImage::SetClip(int x1, int y1, int x2, int y2)
     292{
     293   // If the image does not already have an AImage descriptor, allocate one
    351294   // with no dirty rectangle keeping.
    352295   if (!m_special)
     
    358301}
    359302
    360 void image::GetClip(int &x1, int &y1, int &x2, int &y2)
     303void AImage::GetClip(int &x1, int &y1, int &x2, int &y2)
    361304{
    362305    if (m_special)
     
    368311}
    369312
    370 void image::InClip(int x1, int y1, int x2, int y2)
     313void AImage::InClip(int x1, int y1, int x2, int y2)
    371314{
    372315    if (m_special)
     
    579522}
    580523
    581 void image::Bar(ivec2 p1, ivec2 p2, uint8_t color)
     524void AImage::Bar(ivec2 p1, ivec2 p2, uint8_t color)
    582525{
    583526    if (p1.x > p2.x || p1.y > p2.y)
     
    601544        return;
    602545
    603     Lock();
    604546    for (int y = p1.y; y <= p2.y; y++)
    605547        memset(scan_line(y) + p1.x, color, (p2.x - p1.x + 1));
    606     Unlock();
    607548    AddDirty(p1, p2 + ivec2(1));
    608549}
    609550
    610 void image::xor_bar(int x1, int y1, int x2, int y2, uint8_t color)
     551void AImage::xor_bar(int x1, int y1, int x2, int y2, uint8_t color)
    611552{
    612553  int y, x;
     
    627568    return ;
    628569
    629   Lock();
    630570  uint8_t *sl=scan_line(y1)+x1;
    631571  for (y=y1; y<=y2; y++)
     
    636576    sl+=m_size.x;
    637577  }
    638   Unlock();
    639578
    640579  AddDirty(ivec2(x1, y1), ivec2(x2 + 1, y2 + 1));
     
    642581
    643582
    644 void image::unpack_scanline(int line, char bitsperpixel)
     583void AImage::unpack_scanline(int line, char bitsperpixel)
    645584{
    646585  uint8_t *sl, *ex, mask, bt, sh;
    647586  ex=(uint8_t *)malloc(m_size.x);
    648587
    649   Lock();
    650588  sl=scan_line(line);
    651589  memcpy(ex, sl, m_size.x);
    652   Unlock();
    653590
    654591  if (bitsperpixel==1)      { mask=128;           bt=8; }
     
    665602}
    666603
    667 void image::dither(Palette *pal)
     604void AImage::dither(Palette *pal)
    668605{
    669606    uint8_t const dt_matrix[] =
     
    675612    };
    676613
    677     Lock();
    678614    for (int y = 0; y < m_size.y; y++)
    679615    {
     
    682618            sl[x] = (pal->GetColor(sl[x]).r > dt_matrix[j * 4 + (x & 3)]) ? 255 : 0;
    683619    }
    684     Unlock();
    685620}
    686621
     
    696631}
    697632
    698 void image::Scale(ivec2 new_size)
     633void AImage::Scale(ivec2 new_size)
    699634{
    700635    ivec2 old_size = m_size;
    701636    uint8_t *im = (uint8_t *)malloc(old_size.x * old_size.y);
    702     Lock();
    703637    memcpy(im, scan_line(0), old_size.x * old_size.y);
    704638
    705     DeletePage();
    706     MakePage(new_size, NULL);
    707639    m_size = new_size; // set the new height and width
     640    m_data.Resize(m_size.x * m_size.y);
    708641
    709642    uint8_t *sl1, *sl2;
     
    724657    if (m_special)
    725658        m_special->Resize(new_size);
    726     Unlock();
    727 }
    728 
    729 image *image::create_smooth(int smoothness)
    730 {
    731   ASSERT(smoothness >= 0);
    732 
    733   int i, j, k, l, t, d;
    734   image *im;
    735   if (!smoothness)
    736     return NULL;
    737   d=smoothness*2+1;
    738   d=d*d;
    739   im=new image(m_size);
    740   for (i=0; i<m_size.x; i++)
    741     for (j=0; j<m_size.y; j++)
    742     {
    743       for (t=0, k=-smoothness; k<=smoothness; k++)
    744     for (l=-smoothness; l<=smoothness; l++)
    745       if (i+k>smoothness && i+k<m_size.x-smoothness && j+l<m_size.y-smoothness && j+l>smoothness)
    746         t+=Pixel(ivec2(i+k, j+l));
    747       else t+=Pixel(ivec2(i, j));
    748       im->PutPixel(ivec2(i, j), t/d);
    749     }
    750   return im;
    751 }
    752 
    753 void image::WidgetBar(ivec2 p1, ivec2 p2,
     659}
     660
     661AImage *AImage::create_smooth(int smoothness)
     662{
     663    ASSERT(smoothness >= 0);
     664
     665    if (!smoothness)
     666        return NULL;
     667    int d = smoothness * 2 + 1;
     668    d = d * d;
     669    AImage *im = new AImage(m_size);
     670
     671    /* Box blur */
     672    for (int i = 0; i < m_size.x; i++)
     673        for (int j = 0; j < m_size.y; j++)
     674        {
     675            int t = 0;
     676            for (int k = -smoothness; k <= smoothness; k++)
     677                for (int l = -smoothness; l <= smoothness; l++)
     678                  if (i + k > smoothness && i + k < m_size.x - smoothness
     679                       && j + l < m_size.y - smoothness && j + l > smoothness)
     680                    t += Pixel(ivec2(i + k, j + l));
     681                  else
     682                    t += Pixel(ivec2(i, j));
     683            im->PutPixel(ivec2(i, j), t / d);
     684        }
     685
     686    return im;
     687}
     688
     689void AImage::WidgetBar(ivec2 p1, ivec2 p2,
    754690                      uint8_t light, uint8_t med, uint8_t dark)
    755691{
     
    770706} ;
    771707
    772 void image::flood_fill(int x, int y, uint8_t color)
     708void AImage::flood_fill(int x, int y, uint8_t color)
    773709{
    774710  uint8_t *sl, *above, *below;
    775711  fill_rec *recs=NULL, *r;
    776712  uint8_t fcolor;
    777   Lock();
     713
    778714  sl=scan_line(y);
    779715  fcolor=sl[x];
     
    849785    }
    850786  } while (recs);
    851   Unlock();
    852787}
    853788
     
    855790#define LED_L 5
    856791#define LED_H 5
    857 void image::burn_led(int x, int y, int32_t num, int color, int scale)
     792void AImage::burn_led(int x, int y, int32_t num, int color, int scale)
    858793{
    859794  char st[100];
     
    887822             119, 255, 85, 221};
    888823
    889 image *image::copy_part_dithered (int x1, int y1, int x2, int y2)
     824AImage *AImage::copy_part_dithered (int x1, int y1, int x2, int y2)
    890825{
    891826  int x, y, ry, rx, bo, dity, ditx;
    892   image *ret;
     827  AImage *ret;
    893828  uint8_t *sl1, *sl2;
    894829  ivec2 caa, cbb;
     
    903838
    904839  if (x2<x1 || y2<y1) return NULL;
    905   ret=new image(ivec2((x2-x1+8)/8, (y2-y1+1)));
     840  ret=new AImage(ivec2((x2-x1+8)/8, (y2-y1+1)));
    906841  if (!Palette::LastLoaded())
    907842    ret->clear();
    908843  else
    909844  {
    910     ret->Lock();
    911     Lock();
    912845    for (y=y1, ry=0, dity=(y1%4)*4; y<=y2; y++, ry++)
    913846    {
     
    930863      dity+=4; if (dity>12) dity=0;
    931864    }
    932     Unlock();
    933     ret->Unlock();
    934865  }
    935866  return ret;
    936867}
    937868
    938 void image::FlipX()
    939 {
    940     Lock();
     869void AImage::FlipX()
     870{
    941871    for (int y = 0; y < m_size.y; y++)
    942872    {
     
    949879        }
    950880    }
    951     Unlock();
    952 }
    953 
    954 void image::FlipY()
    955 {
    956     Lock();
     881}
     882
     883void AImage::FlipY()
     884{
    957885    for (int y = 0; y < m_size.y / 2; y++)
    958886    {
     
    966894        }
    967895    }
    968     Unlock();
    969 }
    970 
     896}
     897
  • abuse/branches/lol/src/imlib/image.h

    r698 r709  
    4343{
    4444public:
    45     uint8_t keep_dirt,
    46             static_mem; // if set, don't free memory on exit
     45    uint8_t keep_dirt;
    4746
    4847    linked_list dirties;
    4948    void *extended_descriptor;
    5049
    51     image_descriptor(ivec2 size, int keep_dirties = 1, int static_memory = 0);
     50    image_descriptor(ivec2 size, int keep_dirties = 1);
    5251    int bound_x1(int x1) { return lol::max(x1, m_aa.x); }
    5352    int bound_y1(int y1) { return lol::max(y1, m_aa.y); }
     
    9392};
    9493
    95 class image : public linked_node
     94class AImage : public linked_node
    9695{
     96public:
     97    AImage(bFILE *fp, SpecEntry *e = NULL);
     98    AImage(ivec2 size, int create_descriptor = 0);
     99    ~AImage();
     100
     101    uint8_t Pixel(ivec2 pos);
     102    void PutPixel(ivec2 pos, uint8_t color);
     103
     104    ivec2 Size() const { return m_size; }
     105
    97106private:
    98     uint8_t *m_data;
     107    Array<uint8_t> m_data;
    99108    ivec2 m_size;
    100     bool m_locked;
    101 
    102     void MakePage(ivec2 size, uint8_t *page_buffer);
    103     void DeletePage();
    104109
    105110public:
    106111    image_descriptor *m_special;
    107112
    108     image(bFILE *fp, SpecEntry *e = NULL);
    109     image(ivec2 size, uint8_t *page_buffer = NULL, int create_descriptor = 0);
    110     ~image();
    111 
    112     void Lock();
    113     void Unlock();
    114 
    115     uint8_t Pixel(ivec2 pos);
    116     void PutPixel(ivec2 pos, uint8_t color);
    117 
    118113    inline uint8_t *scan_line(int y)
    119114    {
    120         return m_data + y * m_size.x;
     115        /* FIXME: use the following construct for runtime checks */
     116        //return &m_data[y * m_size.x];
     117
     118        return m_data.Data() + y * m_size.x;
    121119    }
    122     image *copy(); // makes a copy of an image
     120    AImage *copy(); // makes a copy of an image
    123121    void clear(int color = -1); // -1 is background color
    124122
    125     ivec2 Size() const { return m_size; }
    126 
    127     void PutImage(image *screen, ivec2 pos, int transparent = 0);
    128     void PutPart(image *screen, ivec2 pos, ivec2 aa, ivec2 bb,
     123    void PutImage(AImage *screen, ivec2 pos, int transparent = 0);
     124    void PutPart(AImage *screen, ivec2 pos, ivec2 aa, ivec2 bb,
    129125                 int transparent = 0);
    130     image *copy_part_dithered(int x1, int y1, int x2, int y2);
     126    AImage *copy_part_dithered(int x1, int y1, int x2, int y2);
    131127    void Bar(ivec2 p1, ivec2 p2, uint8_t color);
    132128    void xor_bar(int x1, int y1, int x2, int y2, uint8_t color);
     
    166162    void dither(Palette *pal); // use a b&w palette!
    167163    void Scale(ivec2 size);
    168     void SetSize(ivec2 size, uint8_t *page = NULL);
     164    void SetSize(ivec2 size);
    169165    void flood_fill(int x, int y, uint8_t color);
    170     image *create_smooth(int smoothness = 1); // 0 no smoothness
     166    AImage *create_smooth(int smoothness = 1); // 0 no smoothness
    171167    void unpack_scanline(int line, char bitsperpixel = 1);
    172168    void FlipX();
  • abuse/branches/lol/src/imlib/include.cpp

    r694 r709  
    1818#include "ctype.h"
    1919
    20 void write_include(image *im, Palette *pal, char *filename, char *name)
     20void write_include(AImage *im, Palette *pal, char *filename, char *name)
    2121{
    2222  char tmp_name[200];
  • abuse/branches/lol/src/imlib/include.h

    r694 r709  
    1414#include "palette.h"
    1515
    16 void write_include(image *im, Palette *pal, char *filename, char *name);
     16void write_include(AImage *im, Palette *pal, char *filename, char *name);
    1717
    1818#endif
  • abuse/branches/lol/src/imlib/input.cpp

    r707 r709  
    8484}
    8585
    86 void button_box::draw_first(image *screen)
     86void button_box::draw_first(AImage *screen)
    8787{
    8888  for (button *b=buttons; b; b=(button *)b->next)
     
    9090}
    9191
    92 void button_box::draw(int active, image *screen)
     92void button_box::draw(int active, AImage *screen)
    9393{
    9494  return ;
     
    112112}
    113113
    114 void button_box::handle_event(Event &ev, image *screen, InputManager *im)
     114void button_box::handle_event(Event &ev, AImage *screen, InputManager *im)
    115115{
    116116  switch (ev.type)
     
    190190}
    191191
    192 void button::change_visual(image *new_visual)
     192void button::change_visual(AImage *new_visual)
    193193{
    194194    ASSERT(visual);
     
    225225
    226226
    227 button::button(int X, int Y, int ID, image *vis, ifield *Next)
     227button::button(int X, int Y, int ID, AImage *vis, ifield *Next)
    228228{
    229229    m_pos = ivec2(X, Y);
     
    234234}
    235235
    236 button::button(int X, int Y, int ID, image *Depressed, image *Pressed, image *active, ifield *Next)
     236button::button(int X, int Y, int ID, AImage *Depressed, AImage *Pressed, AImage *active, ifield *Next)
    237237{
    238238    m_pos = ivec2(X, Y);
     
    246246
    247247void text_field::change_data(char const *new_data, int new_cursor, // cursor==-1, does not change it.
    248                  int active, image *screen)
     248                 int active, AImage *screen)
    249249{
    250250  if (strlen(format)<strlen(new_data))
     
    264264}
    265265
    266 void text_field::handle_event(Event &ev, image *screen, InputManager *im)
     266void text_field::handle_event(Event &ev, AImage *screen, InputManager *im)
    267267{
    268268  int xx;
     
    308308}
    309309
    310 void text_field::draw(int active, image *screen)
     310void text_field::draw(int active, AImage *screen)
    311311{
    312312  if (active)
     
    364364{ up=!up; }
    365365
    366 void button::handle_event(Event &ev, image *screen, InputManager *im)
     366void button::handle_event(Event &ev, AImage *screen, InputManager *im)
    367367{
    368368  if ((ev.type==EV_KEY && ev.key==13) || (ev.type==EV_MOUSE_BUTTON &&
     
    378378}
    379379
    380 void button::draw(int active, image *screen)
     380void button::draw(int active, AImage *screen)
    381381{
    382382  int x1,y1,x2,y2,color=(active ? wm->bright_color() : wm->medium_color());
     
    402402}
    403403
    404 void button::draw_first(image *screen)
     404void button::draw_first(AImage *screen)
    405405{
    406406    if (pressed)
     
    441441}
    442442
    443 void text_field::draw_first(image *screen)
     443void text_field::draw_first(AImage *screen)
    444444{
    445445  wm->font()->PutString(screen, m_pos + ivec2(0, 3), prompt);
     
    449449
    450450
    451 void text_field::draw_cur(int color, image *screen)
     451void text_field::draw_cur(int color, AImage *screen)
    452452{
    453453  screen->Bar(ivec2(xstart() + cur * wm->font()->Size().x + 1, yend() - 2),
     
    490490}
    491491
    492 void info_field::put_para(image *screen, char const *st, int dx, int dy,
     492void info_field::put_para(AImage *screen, char const *st, int dx, int dy,
    493493              int xspace, int yspace, JCFont *font, int color)
    494494{
     
    510510}
    511511
    512 void info_field::draw_first(image *screen)
     512void info_field::draw_first(AImage *screen)
    513513{
    514514  put_para(screen, text, m_pos.x+1, m_pos.y+1, wm->font()->Size().x,
  • abuse/branches/lol/src/imlib/input.h

    r682 r709  
    2020  int up,act;
    2121  char *text;
    22   image *visual,*pressed,*act_pict;
     22  AImage *visual,*pressed,*act_pict;
    2323  int act_id;
    2424public :
    2525  button(int X, int Y, int ID, char const *Text, ifield *Next);
    26   button(int X, int Y, int ID, image *vis, ifield *Next);
    27   button(int X, int Y, int ID, image *Depressed, image *Pressed, image *active, ifield *Next);
     26  button(int X, int Y, int ID, AImage *vis, ifield *Next);
     27  button(int X, int Y, int ID, AImage *Depressed, AImage *Pressed, AImage *active, ifield *Next);
    2828
    2929  virtual void area(int &x1, int &y1, int &x2, int &y2);
    30   virtual void draw_first(image *screen);
    31   virtual void draw(int active, image *screen);
    32   virtual void handle_event(Event &ev, image *screen, InputManager *im);
    33   void change_visual(image *new_visual);
     30  virtual void draw_first(AImage *screen);
     31  virtual void draw(int active, AImage *screen);
     32  virtual void handle_event(Event &ev, AImage *screen, InputManager *im);
     33  void change_visual(AImage *new_visual);
    3434  virtual void remap(Filter *f);
    3535  virtual ~button() { if (text) free(text); }
     
    5151  virtual void Move(ivec2 pos);
    5252  virtual void area(int &x1, int &y1, int &x2, int &y2);
    53   virtual void draw_first(image *screen);
    54   virtual void draw(int active, image *screen);
    55   virtual void handle_event(Event &ev, image *screen, InputManager *im);
     53  virtual void draw_first(AImage *screen);
     54  virtual void draw(int active, AImage *screen);
     55  virtual void handle_event(Event &ev, AImage *screen, InputManager *im);
    5656  virtual ~button_box();
    5757  virtual char *read();   // return pointer to first button which is depressed
     
    6868  int xend() { return m_pos.x + wm->font()->Size().x * (strlen(prompt) + 1 + strlen(format)) + 7; }
    6969  int yend() { return m_pos.y + wm->font()->Size().y + 5; }
    70   void draw_cur(int color, image *screen);
     70  void draw_cur(int color, AImage *screen);
    7171  int last_spot() { int x=strlen(data); while (x && data[x-1]==' ') x--; return x; }
    72   void draw_text(image *screen)
     72  void draw_text(AImage *screen)
    7373  {
    7474    screen->Bar(ivec2(xstart() + 1, m_pos.y + 1), ivec2(xend() - 1, yend() - 1),
     
    8383
    8484  virtual void area(int &x1, int &y1, int &x2, int &y2);
    85   virtual void draw_first(image *screen);
    86   virtual void draw(int active, image *screen);
    87   virtual void handle_event(Event &ev, image *screen, InputManager *im);
     85  virtual void draw_first(AImage *screen);
     86  virtual void draw(int active, AImage *screen);
     87  virtual void handle_event(Event &ev, AImage *screen, InputManager *im);
    8888
    8989  virtual ~text_field() { free(prompt); free(format); free(data); }
    9090  virtual char *read();
    9191  void change_data(char const *new_data, int new_cursor,       // cursor==-1, does not change it.
    92            int active, image *screen);
     92           int active, AImage *screen);
    9393} ;
    9494
     
    9898  char *text;
    9999  int w,h;
    100   void put_para(image *screen, char const *st, int dx, int dy, int xspace,
     100  void put_para(AImage *screen, char const *st, int dx, int dy, int xspace,
    101101        int yspace, JCFont *font, int color);
    102102public :
    103103  info_field(int X, int Y, int ID, char const *info, ifield *Next);
    104104  virtual void area(int &x1, int &y1, int &x2, int &y2);
    105   virtual void draw_first(image *screen);
    106   virtual void draw(int active, image *screen) { (void)active; (void)screen; }
    107   virtual void handle_event(Event &ev, image *screen, InputManager *im)
     105  virtual void draw_first(AImage *screen);
     106  virtual void draw(int active, AImage *screen) { (void)active; (void)screen; }
     107  virtual void handle_event(Event &ev, AImage *screen, InputManager *im)
    108108  {
    109109      (void)ev; (void)screen; (void)im;
  • abuse/branches/lol/src/imlib/jwindow.cpp

    r694 r709  
    4545
    4646void WindowManager::grab_focus(Jwindow *j)
    47 { m_grab=j; }
     47{
     48    m_grab = j;
     49}
    4850
    4951void WindowManager::release_focus()
    50 { m_grab=NULL; }
    51 
     52{
     53    m_grab = nullptr;
     54}
    5255
    5356void WindowManager::close_window(Jwindow *j)
     
    7073void WindowManager::show_windows()
    7174{
    72   Jwindow *p;
    73   for (p=m_first; p; p=p->next)
    74     if (p->is_hidden())
    75       show_window(p);
     75    for (Jwindow *p = m_first; p; p = p->next)
     76        if (p->is_hidden())
     77            show_window(p);
    7678}
    7779
     
    105107void WindowManager::get_event(Event &ev)
    106108{
    107   Get(ev);
    108 
    109   if (ev.type==EV_KEY)
    110     key_state[ev.key]=1;
    111   else if (ev.type==EV_KEYRELEASE)
    112     key_state[ev.key]=0;
    113 
    114   if (state==inputing)
    115   {
    116     Jwindow *j;
    117     for (ev.window=NULL,j=m_first; j; j=j->next)
    118       if (!j->is_hidden() && ev.mouse_move >= j->m_pos
    119                           && ev.mouse_move < j->m_pos + j->m_size)
    120         ev.window=j;
    121 
    122     if (!ev.window && m_grab) ev.window=m_grab;
    123 
    124     if (ev.window)
    125     {
    126       int closew=0,movew=0;
    127 
    128       if ((ev.type==EV_MOUSE_BUTTON && ev.mouse_button==1 && ev.window &&
    129        ev.mouse_move >= ev.window->m_pos &&
    130        ev.mouse_move < ev.window->m_pos + ivec2(ev.window->m_size.x, ev.window->y1())))
    131       {
    132     if (ev.mouse_move.x-ev.window->m_pos.x < 11) closew=1;
    133     else if (ev.window->is_moveable()) movew=1;
    134       } else if (m_grab)
    135         ev.window=m_grab;
    136 
    137       if (ev.type==EV_KEY && ev.key==JK_ESC)
    138         closew=1;
    139 
    140 
    141 
    142       if (closew)
    143         ev.type=EV_CLOSE_WINDOW;
    144       else if (movew)
    145       {
    146     int red=0;
    147     if (ev.window==m_first)       // see if we need to raise the window
    148     {
    149       m_first=m_first->next;
    150       if (m_first)
    151         red=1;
    152     }
    153     else
    154     {
    155       Jwindow *last=m_first;
    156       for (; last->next!=ev.window; last=last->next);
    157       if (ev.window->next)
    158         red=1;
    159       last->next=ev.window->next;
    160     }
    161     if (!m_first)
    162       m_first=ev.window;
    163     else
    164     {
    165       Jwindow *last=m_first;
    166       for (; last->next; last=last->next);
    167       last->next=ev.window;
    168     }
    169     ev.window->next=NULL;
    170     if (red)
    171     {
    172       Jwindow *j=ev.window;
     109    Get(ev);
     110
     111    if (ev.type == EV_KEY)
     112        key_state[ev.key] = 1;
     113    else if (ev.type == EV_KEYRELEASE)
     114        key_state[ev.key] = 0;
     115
     116    if (state == inputing)
     117    {
     118        Jwindow *j;
     119        for (ev.window = NULL, j = m_first; j; j = j->next)
     120            if (!j->is_hidden() && ev.mouse_move >= j->m_pos
     121                                && ev.mouse_move < j->m_pos + j->m_size)
     122                ev.window = j;
     123
     124        if (!ev.window && m_grab)
     125            ev.window = m_grab;
     126
     127        if (ev.window)
     128        {
     129            int closew = 0, movew = 0;
     130
     131            if ((ev.type == EV_MOUSE_BUTTON && ev.mouse_button == 1 && ev.window &&
     132                ev.mouse_move >= ev.window->m_pos &&
     133                ev.mouse_move < ev.window->m_pos + ivec2(ev.window->m_size.x, ev.window->y1())))
     134            {
     135                if (ev.mouse_move.x - ev.window->m_pos.x < 11)
     136                    closew = 1;
     137                else if (ev.window->is_moveable())
     138                    movew = 1;
     139            }
     140            else if (m_grab)
     141                ev.window = m_grab;
     142
     143            if (ev.type == EV_KEY && ev.key == JK_ESC)
     144                closew = 1;
     145
     146            if (closew)
     147                ev.type = EV_CLOSE_WINDOW;
     148            else if (movew)
     149            {
     150                int red = 0;
     151                if (ev.window == m_first)       // see if we need to raise the window
     152                {
     153                    m_first = m_first->next;
     154                    if (m_first)
     155                        red = 1;
     156                }
     157                else
     158                {
     159                    Jwindow *last = m_first;
     160                    for (; last->next != ev.window; last = last->next)
     161                        ;
     162                    if (ev.window->next)
     163                        red = 1;
     164                    last->next = ev.window->next;
     165                }
     166                if (!m_first)
     167                    m_first = ev.window;
     168                else
     169                {
     170                    Jwindow *last = m_first;
     171                    for (; last->next; last=last->next)
     172                        ;
     173                    last->next = ev.window;
     174                }
     175                ev.window->next = nullptr;
     176                if (red)
     177                {
     178                    Jwindow *j = ev.window;
    173179/*      m_surf->AddDirty(j->x,j->y,j->x+j->l,j->y+j->h);
    174180      for (p=m_first; p!=j; p=p->next)
    175181        p->m_surf->AddDirty(j->x-p->x,j->y-p->y,j->x+j->l-p->x,j->y+j->h-p->y); */
    176       j->m_surf->AddDirty(ivec2(0), j->m_size);
    177       flush_screen();
    178     }
    179 
    180         state=dragging;
    181         drag_window=ev.window;
    182         drag_mousex=ev.window->m_pos.x-ev.mouse_move.x;
    183         drag_mousey=ev.window->m_pos.y-ev.mouse_move.y;
    184         ev.type=EV_SPURIOUS;
    185       } else if (ev.window)
    186         ev.window->inm->handle_event(ev,ev.window);
    187     }
    188   } else if (state==dragging)
    189   {
    190     ev.window=drag_window;
    191     if (ev.type==EV_MOUSE_BUTTON && ev.mouse_button==0)  // user released the mouse
    192     {
    193       state=inputing;
    194       ev.type=EV_SPURIOUS;
    195     } else if (ev.type==EV_MOUSE_MOVE)
    196     {
    197        move_window(drag_window,ev.mouse_move.x+drag_mousex,ev.mouse_move.y+drag_mousey);
    198        flush_screen();
    199        ev.type=EV_DRAG_WINDOW;
    200        ev.window_position.x=ev.mouse_move.x+drag_mousex;
    201        ev.window_position.y=ev.mouse_move.y+drag_mousey;
    202     }
    203   }
     182                    j->m_surf->AddDirty(ivec2(0), j->m_size);
     183                    flush_screen();
     184                }
     185
     186                state = dragging;
     187                drag_window = ev.window;
     188                drag_mousex = ev.window->m_pos.x - ev.mouse_move.x;
     189                drag_mousey = ev.window->m_pos.y - ev.mouse_move.y;
     190                ev.type = EV_SPURIOUS;
     191            }
     192            else if (ev.window)
     193                ev.window->inm->handle_event(ev, ev.window);
     194        }
     195    }
     196    else if (state == dragging)
     197    {
     198        ev.window = drag_window;
     199        if (ev.type == EV_MOUSE_BUTTON && ev.mouse_button == 0)  // user released the mouse
     200        {
     201          state = inputing;
     202          ev.type = EV_SPURIOUS;
     203        }
     204        else if (ev.type == EV_MOUSE_MOVE)
     205        {
     206           move_window(drag_window,
     207                       ev.mouse_move.x + drag_mousex,
     208                       ev.mouse_move.y + drag_mousey);
     209           flush_screen();
     210           ev.type = EV_DRAG_WINDOW;
     211           ev.window_position.x = ev.mouse_move.x + drag_mousex;
     212           ev.window_position.y = ev.mouse_move.y + drag_mousey;
     213        }
     214    }
    204215}
    205216
     
    212223void WindowManager::resize_window(Jwindow *j, int l, int h)
    213224{
    214   Jwindow *p;
    215   m_surf->AddDirty(j->m_pos, j->m_pos + j->m_size);
    216   for (p=m_first; p!=j; p=p->next)
    217     p->m_surf->AddDirty(j->m_pos - p->m_pos,
    218                         j->m_pos - p->m_pos + j->m_size);
    219   j->Resize(ivec2(l,h));
    220   if (!frame_suppress)
    221   j->redraw();
     225    m_surf->AddDirty(j->m_pos, j->m_pos + j->m_size);
     226    for (Jwindow *p = m_first; p != j; p = p->next)
     227        p->m_surf->AddDirty(j->m_pos - p->m_pos,
     228                            j->m_pos - p->m_pos + j->m_size);
     229    j->Resize(ivec2(l, h));
     230    if (!frame_suppress)
     231        j->redraw();
    222232}
    223233
     
    233243}
    234244
    235 WindowManager::WindowManager(image *screen, Palette *pal, int Hi,
     245WindowManager::WindowManager(AImage *screen, Palette *pal, int Hi,
    236246                             int Med, int Low, JCFont *Font)
    237247  : EventHandler(screen, pal)
     
    255265void WindowManager::add_window(Jwindow *win)
    256266{
    257     if(!m_first)
     267    if (!m_first)
    258268        m_first = win;
    259269    else
    260270    {
    261271        Jwindow *tmp = m_first;
    262         while(tmp->next)
     272        while (tmp->next)
    263273            tmp = tmp->next;
    264274        tmp->next = win;
    265         win->next = NULL;
     275        win->next = nullptr;
    266276    }
    267277}
     
    270280{
    271281    if(m_grab == win)
    272         m_grab = NULL;
     282        m_grab = nullptr;
    273283
    274284    // close the window we were dragging
     
    360370    // property.flags = JWINDOW_NOAUTOHIDE_FLAG;
    361371
    362     inm = new InputManager(this, NULL);
     372    inm = new InputManager(this, nullptr);
    363373    reconfigure();
    364374
    365     m_surf = NULL;
    366     next = NULL;
    367 
    368     _name = NULL;
     375    m_surf = nullptr;
     376    next = nullptr;
     377
     378    _name = nullptr;
    369379    if(name)
    370380        _name = strdup(name);
     
    381391    _y1 = name ? top_border() : jw_top + 5;
    382392
    383     m_surf = NULL;
     393    m_surf = nullptr;
    384394    inm = new InputManager(m_surf, f);
    385395    reconfigure(); /* FIXME: TODO */
     
    400410    if(size.y == -1)
    401411        m_size.y = lol::max(m_size.y, top_border() + bottom_border());
    402     m_surf = new image(m_size, NULL, 2);
     412    m_surf = new AImage(m_size, 2);
    403413    m_surf->clear(backg);
    404414    // Keep this from getting destroyed when image list is cleared
     
    406416    inm->m_surf = m_surf;
    407417
    408     next = NULL;
    409 
    410     _name = NULL;
     418    next = nullptr;
     419
     420    _name = nullptr;
    411421    if(name)
    412422        _name = strdup(name);
     
    522532}
    523533
    524 
    525 ifield *InputManager::unlink(int id)     // unlinks ID from fields list and return the pointer to it
    526 {
    527   for (ifield *i=m_first,*last=NULL; i; i=i->next)
    528   {
    529     if (i->id==id)
    530     {
    531       if (i==m_first)
    532     m_first=m_first->next;
    533       else
    534         last->next=i->next;
    535       if (m_active==i)
    536         m_active=m_first;
    537       return i;
    538     }
    539     ifield *x=i->unlink(id);
    540     if (x) return x;
    541     last=i;
    542   }
    543   return NULL;   // no such id
     534// unlinks ID from fields list and return the pointer to it
     535ifield *InputManager::unlink(int id)
     536{
     537    for (ifield *i = m_first, *last = nullptr; i; i = i->next)
     538    {
     539        if (i->id == id)
     540        {
     541            if (i == m_first)
     542                m_first = m_first->next;
     543            else
     544                last->next = i->next;
     545
     546            if (m_active == i)
     547                m_active = m_first;
     548
     549            return i;
     550        }
     551        ifield *x = i->unlink(id);
     552        if (x)
     553            return x;
     554        last = i;
     555    }
     556    return nullptr; // no such id
    544557}
    545558
     
    638651void InputManager::redraw()
    639652{
    640     ifield *i;
    641     if(m_owner)
     653    if (m_owner)
    642654        m_surf = m_owner->m_surf;
    643     for(i = m_first; i; i = i->next)
     655    for (ifield *i = m_first; i; i = i->next)
    644656        i->draw_first(m_surf);
    645     if(m_active)
     657    if (m_active)
    646658        m_active->draw(1, m_surf);
    647659}
    648660
    649 InputManager::InputManager(image *screen, ifield *first)
     661InputManager::InputManager(AImage *screen, ifield *first)
    650662{
    651663    no_selections_allowed = 0;
     
    655667    m_surf = screen;
    656668    m_active = m_first = first;
    657     while(m_active && !m_active->selectable())
     669    while (m_active && !m_active->selectable())
    658670        m_active = m_active->next;
    659     if(m_surf)
     671    if (m_surf)
    660672        redraw();
    661673}
     
    695707
    696708void InputManager::add(ifield *i)
    697 { ifield *f=m_first;
    698   if (i->selectable())
    699   {
    700     if (!f)
    701       m_first=i;
    702     else
    703     {
    704       while (f->next) f=f->next;
    705       f->next=i;
    706     }
    707   }
     709{
     710    if (i->selectable())
     711    {
     712        if (!m_first)
     713            m_first = i;
     714        else
     715        {
     716            ifield *f = m_first;
     717            while (f->next)
     718                f = f->next;
     719            f->next = i;
     720        }
     721    }
    708722}
    709723
    710724ifield *InputManager::get(int id)
    711725{
    712   ifield *f;
    713   for (f=m_first; f; f=f->next)
    714   {
    715     ifield *ret=f->find(id);
    716     if (ret) return ret;
    717   }
    718   return NULL;
     726    for (ifield * f = m_first; f; f = f->next)
     727    {
     728        ifield *ret = f->find(id);
     729        if (ret)
     730            return ret;
     731    }
     732    return nullptr;
    719733}
    720734
    721735ifield::ifield()
    722736{
    723     owner = NULL;
     737    owner = nullptr;
    724738    m_pos = ivec2(0, 0);
    725     next = NULL;
     739    next = nullptr;
    726740    id = 0;
    727741}
  • abuse/branches/lol/src/imlib/jwindow.h

    r698 r709  
    3434
    3535public:
    36     InputManager(image *screen, ifield *first);
     36    InputManager(AImage *screen, ifield *first);
    3737    InputManager(Jwindow *owner, ifield *first);
    3838    ~InputManager();
     
    5050
    5151private:
    52     image *m_surf;
     52    AImage *m_surf;
    5353    ifield *m_first, *m_active, *m_grab;
    5454    Jwindow *m_cur, *m_owner;
     
    6868    virtual void Move(ivec2 pos) { m_pos = pos; }
    6969    virtual void area(int &x1, int &y1, int &x2, int &y2) = 0;
    70     virtual void draw_first(image *screen) = 0;
    71     virtual void draw(int active, image *screen) = 0;
    72     virtual void handle_event(Event &ev, image *screen, InputManager *im) = 0;
     70    virtual void draw_first(AImage *screen) = 0;
     71    virtual void draw(int active, AImage *screen) = 0;
     72    virtual void handle_event(Event &ev, AImage *screen, InputManager *im) = 0;
    7373    virtual int selectable() { return 1; }
    7474    virtual void remap(Filter *f) { (void)f; }
     
    122122
    123123    ivec2 m_pos, m_size;
    124     image *m_surf;
     124    AImage *m_surf;
    125125
    126126protected:
     
    145145
    146146public:
    147     WindowManager(image *, Palette *, int hi, int med, int low, JCFont *);
     147    WindowManager(AImage *, Palette *, int hi, int med, int low, JCFont *);
    148148    ~WindowManager();
    149149
    150150    Jwindow *m_first, *m_grab;
    151     image *mouse_pic, *mouse_save;
     151    AImage *mouse_pic, *mouse_save;
    152152    int hi, med, low, bk; // bright, medium, dark and black colors
    153153    int key_state[512];
     
    183183private:
    184184    Palette *m_pal;
    185     image *m_surf;
     185    AImage *m_surf;
    186186};
    187187
  • abuse/branches/lol/src/imlib/pcxread.cpp

    r694 r709  
    120120}
    121121
    122 image *read_PCX(char const *filename, Palette *&pal)
     122AImage *read_PCX(char const *filename, Palette *&pal)
    123123{
    124124  if (PCX_file_type(filename)!=PCX_8) return NULL;
     
    126126  read_PCX_header(fp);
    127127
    128   image *im=new image(ivec2(PCX_header.xmax-PCX_header.xmin+1,
     128  AImage *im=new AImage(ivec2(PCX_header.xmax-PCX_header.xmin+1,
    129129                            PCX_header.ymax-PCX_header.ymin+1));
    130130  int y;
     
    146146}
    147147
    148 void write_PCX(image *im, Palette *pal, char const *filename)
     148void write_PCX(AImage *im, Palette *pal, char const *filename)
    149149{
    150150  FILE *fp=fopen(filename,"wb");
  • abuse/branches/lol/src/imlib/pcxread.h

    r694 r709  
    1515#include "palette.h"
    1616
    17 void write_PCX(image *im, Palette *pal, char const *filename);
    18 image *read_PCX(char const *filename, Palette *&pal);
     17void write_PCX(AImage *im, Palette *pal, char const *filename);
     18AImage *read_PCX(char const *filename, Palette *&pal);
    1919
    2020#endif
  • abuse/branches/lol/src/imlib/pmenu.cpp

    r707 r709  
    2424}
    2525
    26 pmenu::pmenu(int X, int Y, pmenu_item *first, image *screen)
     26pmenu::pmenu(int X, int Y, pmenu_item *first, AImage *screen)
    2727{
    2828  top=first;
     
    312312
    313313
    314 void pmenu::draw(image *screen, int top_only)
     314void pmenu::draw(AImage *screen, int top_only)
    315315{
    316316
     
    380380}
    381381
    382 pmenu_item *pmenu::inarea(int mx, int my, image *screen)
     382pmenu_item *pmenu::inarea(int mx, int my, AImage *screen)
    383383{
    384384  mx-=bar->m_pos.x;
     
    416416}
    417417
    418 int pmenu::handle_event(Event &ev, image *screen)
     418int pmenu::handle_event(Event &ev, AImage *screen)
    419419{
    420420  if (!active && ev.window!=bar) return 0;
  • abuse/branches/lol/src/imlib/pmenu.h

    r668 r709  
    6666  { return strlen(p->name())*wm->font()->Size().x+2; }
    6767  int itemx(pmenu_item *p);
    68   pmenu_item *inarea(int mx, int my, image *screen);
     68  pmenu_item *inarea(int mx, int my, AImage *screen);
    6969public :
    7070  ~pmenu();
    71   pmenu(int X, int Y, pmenu_item *first, image *screen);
     71  pmenu(int X, int Y, pmenu_item *first, AImage *screen);
    7272  void move(int new_x, int new_y);
    73   void draw(image *screen, int top_only=0);
    74   int handle_event(Event &ev, image *screen);
     73  void draw(AImage *screen, int top_only=0);
     74  int handle_event(Event &ev, AImage *screen);
    7575
    7676} ;
  • abuse/branches/lol/src/imlib/scroller.cpp

    r707 r709  
    5555    0, 0, 0, 0, 0};
    5656
    57 void show_icon(image *screen, int x, int y, int icw, int ich, uint8_t *buf)
     57void show_icon(AImage *screen, int x, int y, int icw, int ich, uint8_t *buf)
    5858{
    5959  ivec2 caa, cbb;
     
    6565  remap[2]=wm->dark_color();
    6666
    67   screen->Lock();
    6867  for (int yc=ich; yc; yc--,y++)
    6968  {
     
    7978  }
    8079  screen->AddDirty(ivec2(x, y), ivec2(x + icw, y + ich));
    81   screen->Unlock();
    8280}
    8381
     
    120118
    121119
    122 void scroller::draw_first(image *screen)
     120void scroller::draw_first(AImage *screen)
    123121{
    124122  if (sx>=t) sx=t-1;
     
    163161}
    164162
    165 void scroller::draw_widget(image *screen, int erase)
     163void scroller::draw_widget(AImage *screen, int erase)
    166164{
    167165  int x1,y1,x2,y2;
     
    174172}
    175173
    176 void scroller::draw(int active, image *screen)
     174void scroller::draw(int active, AImage *screen)
    177175{
    178176  int x1,y1,x2,y2;
     
    182180}
    183181
    184 void scroller::handle_event(Event &ev, image *screen, InputManager *inm)
     182void scroller::handle_event(Event &ev, AImage *screen, InputManager *inm)
    185183{
    186184  int mx=ev.mouse_move.x,my=ev.mouse_move.y;
     
    286284
    287285
    288 void scroller::handle_right(image *screen, InputManager *inm)
     286void scroller::handle_right(AImage *screen, InputManager *inm)
    289287{
    290288  if (!vert && sx<t-1)
     
    297295}
    298296
    299 void scroller::handle_left(image *screen, InputManager *inm)
     297void scroller::handle_left(AImage *screen, InputManager *inm)
    300298{
    301299  if (!vert && sx>1)
     
    308306}
    309307
    310 void scroller::handle_up(image *screen, InputManager *inm)
     308void scroller::handle_up(AImage *screen, InputManager *inm)
    311309{
    312310  if (vert && sx>1)
     
    319317}
    320318
    321 void scroller::handle_down(image *screen, InputManager *inm)
     319void scroller::handle_down(AImage *screen, InputManager *inm)
    322320{
    323321  if (vert && sx<t-1)
     
    330328}
    331329
    332 void scroller::set_x (int x, image *screen)
     330void scroller::set_x (int x, AImage *screen)
    333331{
    334332  if (x<0) x=0;
     
    365363
    366364
    367 void scroller::scroll_event(int newx, image *screen)
     365void scroller::scroll_event(int newx, AImage *screen)
    368366{
    369367  screen->Bar(m_pos, m_pos + ivec2(l - 1, h - 1), wm->black());
     
    393391
    394392pick_list::pick_list(int X, int Y, int ID, int height,
    395         char **List, int num_entries, int start_yoffset, ifield *Next, image *texture)
     393        char **List, int num_entries, int start_yoffset, ifield *Next, AImage *texture)
    396394     : scroller(X,Y,ID,2,2,1,0,Next)
    397395{
     
    416414}
    417415
    418 void pick_list::handle_inside_event(Event &ev, image *screen, InputManager *inm)
     416void pick_list::handle_inside_event(Event &ev, AImage *screen, InputManager *inm)
    419417{
    420418  if (ev.type==EV_MOUSE_MOVE && activate_on_mouse_move())
     
    462460}
    463461
    464 void pick_list::handle_up(image *screen, InputManager *inm)
     462void pick_list::handle_up(AImage *screen, InputManager *inm)
    465463{
    466464  if (cur_sel>0)
     
    476474}
    477475
    478 void pick_list::handle_down(image *screen, InputManager *inm)
     476void pick_list::handle_down(AImage *screen, InputManager *inm)
    479477{
    480478  if (cur_sel<t-1)
     
    490488}
    491489
    492 void pick_list::scroll_event(int newx, image *screen)
     490void pick_list::scroll_event(int newx, AImage *screen)
    493491{
    494492  last_sel=newx;
     
    581579}
    582580
    583 void spicker::draw_background(image *screen)
     581void spicker::draw_background(AImage *screen)
    584582{
    585583    screen->Bar(m_pos, m_pos + ivec2(l - 1, h - 1), wm->dark_color());
     
    593591}
    594592
    595 void spicker::set_x(int x, image *screen)
     593void spicker::set_x(int x, AImage *screen)
    596594{
    597595  cur_sel=x;
     
    601599
    602600
    603 void spicker::scroll_event(int newx, image *screen)
     601void spicker::scroll_event(int newx, AImage *screen)
    604602{
    605603  last_sel=newx;
     
    625623
    626624
    627 void spicker::handle_inside_event(Event &ev, image *screen, InputManager *inm)
     625void spicker::handle_inside_event(Event &ev, AImage *screen, InputManager *inm)
    628626{
    629627  switch (ev.type)
     
    688686
    689687
    690 void spicker::handle_up(image *screen, InputManager *inm)
     688void spicker::handle_up(AImage *screen, InputManager *inm)
    691689{
    692690  if (vert && cur_sel>0)
     
    705703}
    706704
    707 void spicker::handle_down(image *screen, InputManager *inm)
     705void spicker::handle_down(AImage *screen, InputManager *inm)
    708706{
    709707  if (vert && cur_sel<t-1)
     
    720718}
    721719
    722 void spicker::handle_left(image *screen, InputManager *inm)
    723 {
    724 }
    725 
    726 void spicker::handle_right(image *screen, InputManager *inm)
    727 {
    728 }
    729 
    730 
    731 
    732 
     720void spicker::handle_left(AImage *screen, InputManager *inm)
     721{
     722}
     723
     724void spicker::handle_right(AImage *screen, InputManager *inm)
     725{
     726}
     727
     728
     729
     730
  • abuse/branches/lol/src/imlib/scroller.h

    r659 r709  
    3434  int wig_x();
    3535  int darea() { return (l-bw()-2)-bw()-bw(); }
    36   void draw_widget(image *screen, int erase);
     36  void draw_widget(AImage *screen, int erase);
    3737  int mouse_to_drag(int mx,int my);
    3838public :
     
    4040  scroller(int X, int Y, int ID, int L, int H, int Vert, int Total_items, ifield *Next);
    4141  virtual void area(int &x1, int &y1, int &x2, int &y2);
    42   virtual void draw_first(image *screen);
    43   virtual void draw(int active, image *screen);
    44   virtual void handle_event(Event &ev, image *screen, InputManager *im);
     42  virtual void draw_first(AImage *screen);
     43  virtual void draw(int active, AImage *screen);
     44  virtual void handle_event(Event &ev, AImage *screen, InputManager *im);
    4545  virtual char *read() { return (char *)&sx; }
    4646
    4747  virtual int activate_on_mouse_move() { return 1; }
    48   virtual void handle_inside_event(Event &ev, image *screen, InputManager *inm) { ; }
    49   virtual void scroll_event(int newx, image *screen);
    50   virtual void handle_up(image *screen, InputManager *inm);
    51   virtual void handle_down(image *screen, InputManager *inm);
    52   virtual void handle_left(image *screen, InputManager *inm);
    53   virtual void handle_right(image *screen, InputManager *inm);
     48  virtual void handle_inside_event(Event &ev, AImage *screen, InputManager *inm) { ; }
     49  virtual void scroll_event(int newx, AImage *screen);
     50  virtual void handle_up(AImage *screen, InputManager *inm);
     51  virtual void handle_down(AImage *screen, InputManager *inm);
     52  virtual void handle_left(AImage *screen, InputManager *inm);
     53  virtual void handle_right(AImage *screen, InputManager *inm);
    5454  virtual void area_config() { ; }
    5555  void set_size(int width, int height) { l=width; h=height; }
    56   virtual void set_x(int x, image *screen);
     56  virtual void set_x(int x, AImage *screen);
    5757} ;
    5858
     
    6969  int get_select(int x);
    7070  int first_selected();
    71   virtual void scroll_event(int newx, image *screen);
    72   virtual void handle_inside_event(Event &ev, image *screen, InputManager *inm);
     71  virtual void scroll_event(int newx, AImage *screen);
     72  virtual void handle_inside_event(Event &ev, AImage *screen, InputManager *inm);
    7373
    7474  // you should define \/
    75   virtual void draw_background(image *screen);
    76   virtual void draw_item(image *screen, int x, int y, int num, int active) = 0;
     75  virtual void draw_background(AImage *screen);
     76  virtual void draw_item(AImage *screen, int x, int y, int num, int active) = 0;
    7777  virtual int total() = 0;
    7878  virtual int item_width() = 0;
    7979  virtual int item_height() = 0;
    80   virtual void note_selection(image *screen, InputManager *inm, int x) { ; }
    81   virtual void note_new_current(image *screen, InputManager *inm, int x) { ; }
     80  virtual void note_selection(AImage *screen, InputManager *inm, int x) { ; }
     81  virtual void note_new_current(AImage *screen, InputManager *inm, int x) { ; }
    8282  virtual int ok_to_select(int num) { return 1; }
    83   virtual void handle_up(image *screen, InputManager *inm);
    84   virtual void handle_down(image *screen, InputManager *inm);
    85   virtual void handle_left(image *screen, InputManager *inm);
    86   virtual void handle_right(image *screen, InputManager *inm);
    87   virtual void set_x(int x, image *screen);
     83  virtual void handle_up(AImage *screen, InputManager *inm);
     84  virtual void handle_down(AImage *screen, InputManager *inm);
     85  virtual void handle_left(AImage *screen, InputManager *inm);
     86  virtual void handle_right(AImage *screen, InputManager *inm);
     87  virtual void set_x(int x, AImage *screen);
    8888  void reconfigure();   // should be called by constructor after class is ready to take virtual calls
    8989  ~spicker() { if (select) free(select); }
     
    101101  pick_list_item *lis;
    102102  char key_hist[20],key_hist_total;
    103   image *tex;
     103  AImage *tex;
    104104  public :
    105105  pick_list(int X, int Y, int ID, int height,
    106         char **List, int num_entries, int start_yoffset, ifield *Next, image *texture=NULL);
    107   virtual void handle_inside_event(Event &ev, image *screen, InputManager *inm);
    108   virtual void scroll_event(int newx, image *screen);
     106        char **List, int num_entries, int start_yoffset, ifield *Next, AImage *texture=NULL);
     107  virtual void handle_inside_event(Event &ev, AImage *screen, InputManager *inm);
     108  virtual void scroll_event(int newx, AImage *screen);
    109109  virtual char *read() { return (char *)this; }
    110110  virtual void area_config();
    111   virtual void handle_up(image *screen, InputManager *inm);
    112   virtual void handle_down(image *screen, InputManager *inm);
     111  virtual void handle_up(AImage *screen, InputManager *inm);
     112  virtual void handle_down(AImage *screen, InputManager *inm);
    113113  int get_selection() { return lis[cur_sel].number; }
    114114  ~pick_list() { free(lis); }
  • abuse/branches/lol/src/imlib/specs.cpp

    r698 r709  
    3636    "Palette",      // 2
    3737    "Invalid Type", // 3
    38     "Image",        // 4
     38    "AImage",        // 4
    3939    "Fore Tile",
    4040    "Back Tile",
     
    4848    "Normal file",
    4949    "Compress1 file",
    50     "Vector Image",
     50    "Vector AImage",
    5151    "Light list",
    5252    "Grue fgmap",
  • abuse/branches/lol/src/imlib/sprite.cpp

    r687 r709  
    2323#include "sprite.h"
    2424
    25 ASprite::ASprite(image *screen, image *visual, ivec2 pos)
     25ASprite::ASprite(AImage *screen, AImage *visual, ivec2 pos)
    2626{
    2727    ASSERT(visual);
     
    3131    m_visual = visual;
    3232    m_screen = screen;
    33     m_save = new image(visual->Size());
     33    m_save = new AImage(visual->Size());
    3434
    3535    if (m_pos + visual->Size() >= ivec2(0) && m_pos < ivec2(xres, yres))
     
    4242}
    4343
    44 void ASprite::SetVisual(image *visual, int delete_old)
     44void ASprite::SetVisual(AImage *visual, int delete_old)
    4545{
    4646    if (delete_old)
     
    5050    {
    5151        delete m_save;
    52         m_save = new image(visual->Size());
     52        m_save = new AImage(visual->Size());
    5353    }
    5454
  • abuse/branches/lol/src/imlib/sprite.h

    r686 r709  
    1818{
    1919public:
    20     ASprite(image *screen, image *visual, ivec2 pos);
     20    ASprite(AImage *screen, AImage *visual, ivec2 pos);
    2121    ~ASprite();
    2222
    23     void SetVisual(image *visual, int delete_old = 0);
     23    void SetVisual(AImage *visual, int delete_old = 0);
    2424
    25     image *m_visual, *m_screen, *m_save;
     25    AImage *m_visual, *m_screen, *m_save;
    2626
    2727private:
  • abuse/branches/lol/src/imlib/supmorph.cpp

    r708 r709  
    201201}
    202202
    203 smorph_player::smorph_player(super_morph *m, Palette *pal, image *i1, image *i2, int frames, int dir)
     203smorph_player::smorph_player(super_morph *m, Palette *pal, AImage *i1, AImage *i2, int frames, int dir)
    204204{
    205205  unsigned char *d = m->movers;
     
    242242}
    243243
    244 int smorph_player::show(image *screen, int x, int y, ColorFilter *fil, Palette *pal,
     244int smorph_player::show(AImage *screen, int x, int y, ColorFilter *fil, Palette *pal,
    245245            int blur_threshold)
    246246{
     
    329329  FILE *fp=fopen("art/mrphmask.spe","rb");
    330330  SpecDir sd(fp);
    331   image *h1=new image(sd.find("20 h"),fp),
    332         *h2=new image(sd.find("1h"),fp),
    333         *i1=new image(sd.find("20"),fp),
    334         *i2=new image(sd.find("1"),fp);
     331  AImage *h1=new AImage(sd.find("20 h"),fp),
     332        *h2=new AImage(sd.find("1h"),fp),
     333        *i1=new AImage(sd.find("20"),fp),
     334        *i2=new AImage(sd.find("1"),fp);
    335335  palette *pal=new palette(sd.find(SPEC_PALETTE),fp);
    336336  color_filter *fil=new color_filter(sd.find(SPEC_COLOR_TABLE),fp);
  • abuse/branches/lol/src/imlib/supmorph.h

    r694 r709  
    3636public :
    3737  int w,h,f_left,t;
    38   smorph_player(super_morph *m, Palette *pal, image *i1, image *i2, int frames, int dir);
    39   int show(image *screen, int x, int y, ColorFilter *fil, Palette *pal, int blur_threshold);
     38  smorph_player(super_morph *m, Palette *pal, AImage *i1, AImage *i2, int frames, int dir);
     39  int show(AImage *screen, int x, int y, ColorFilter *fil, Palette *pal, int blur_threshold);
    4040  ~smorph_player() { free(hole); free(steps);  }
    4141} ;
  • abuse/branches/lol/src/imlib/tools.cpp

    r694 r709  
    4444}
    4545
    46 void tool_picker::remap(Palette *pal, image *screen)
     46void tool_picker::remap(Palette *pal, AImage *screen)
    4747{
    4848    delete map;
     
    5151}
    5252
    53 void tool_picker::draw_item(image *screen, int x, int y, int num, int active)
     53void tool_picker::draw_item(AImage *screen, int x, int y, int num, int active)
    5454{
    5555    screen->Bar(ivec2(x, y), ivec2(x + iw - 1, y + ih - 1),
  • abuse/branches/lol/src/imlib/tools.h

    r707 r709  
    3434          Palette *icon_palette, Palette *pal, ifield *Next);
    3535
    36   virtual void draw_item(image *screen, int x, int y, int num, int active);
     36  virtual void draw_item(AImage *screen, int x, int y, int num, int active);
    3737  virtual int total() { return total_icons; }
    3838  virtual int item_width() { return iw; }
    3939  virtual int item_height() { return ih; }
    40   virtual void note_new_current(image *screen, InputManager *inm, int x)
     40  virtual void note_new_current(AImage *screen, InputManager *inm, int x)
    4141  { wm->Push(Event(ids[x], NULL)); }
    4242
    43   void remap(Palette *pal, image *screen);
     43  void remap(Palette *pal, AImage *screen);
    4444  ~tool_picker();
    4545} ;
  • abuse/branches/lol/src/imlib/transimage.cpp

    r694 r709  
    2020#include "transimage.h"
    2121
    22 TransImage::TransImage(image *im, char const *name)
     22TransImage::TransImage(AImage *im, char const *name)
    2323{
    2424    m_size = im->Size();
    25 
    26     im->Lock();
    2725
    2826    // First find out how much data to allocate
     
    9088        }
    9189    }
    92     im->Unlock();
    9390}
    9491
     
    9895}
    9996
    100 image *TransImage::ToImage()
    101 {
    102     image *im = new image(m_size);
     97AImage *TransImage::ToImage()
     98{
     99    AImage *im = new AImage(m_size);
    103100
    104101    // FIXME: this is required until FILLED mode is fixed
    105     im->Lock();
    106102    memset(im->scan_line(0), 0, m_size.x * m_size.y);
    107     im->Unlock();
    108103
    109104    PutImage(im, ivec2(0));
     
    111106}
    112107
    113 uint8_t *TransImage::ClipToLine(image *screen, ivec2 pos1, ivec2 pos2,
     108uint8_t *TransImage::ClipToLine(AImage *screen, ivec2 pos1, ivec2 pos2,
    114109                                ivec2 &pos, int &ysteps)
    115110{
     
    146141
    147142template<int N>
    148 void TransImage::PutImageGeneric(image *screen, ivec2 pos, uint8_t color,
    149                                  image *blend, ivec2 bpos, uint8_t *map,
     143void TransImage::PutImageGeneric(AImage *screen, ivec2 pos, uint8_t color,
     144                                 AImage *blend, ivec2 bpos, uint8_t *map,
    150145                                 uint8_t *map2, int amount, int nframes,
    151146                                 uint8_t *tint, ColorFilter *f, Palette *pal)
     
    181176        ysteps = lol::min(ysteps, pos2.y - 1 - pos.y - 2);
    182177
    183     screen->Lock();
    184 
    185178    screen_line = screen->scan_line(pos.y) + pos.x;
    186179    int sw = screen->Size().x;
     
    268261        screen_line += sw - m_size.x;
    269262    }
    270     screen->Unlock();
    271 }
    272 
    273 void TransImage::PutImage(image *screen, ivec2 pos)
     263}
     264
     265void TransImage::PutImage(AImage *screen, ivec2 pos)
    274266{
    275267    PutImageGeneric<NORMAL>(screen, pos, 0, NULL, ivec2(0), NULL, NULL,
     
    277269}
    278270
    279 void TransImage::PutRemap(image *screen, ivec2 pos, uint8_t *map)
     271void TransImage::PutRemap(AImage *screen, ivec2 pos, uint8_t *map)
    280272{
    281273    PutImageGeneric<REMAP>(screen, pos, 0, NULL, ivec2(0), map, NULL,
     
    283275}
    284276
    285 void TransImage::PutDoubleRemap(image *screen, ivec2 pos,
     277void TransImage::PutDoubleRemap(AImage *screen, ivec2 pos,
    286278                            uint8_t *map, uint8_t *map2)
    287279{
     
    291283
    292284// Used when eg. the player teleports, or in rocket trails
    293 void TransImage::PutFade(image *screen, ivec2 pos, int amount, int nframes,
     285void TransImage::PutFade(AImage *screen, ivec2 pos, int amount, int nframes,
    294286                         ColorFilter *f, Palette *pal)
    295287{
     
    298290}
    299291
    300 void TransImage::PutFadeTint(image *screen, ivec2 pos, int amount, int nframes,
     292void TransImage::PutFadeTint(AImage *screen, ivec2 pos, int amount, int nframes,
    301293                             uint8_t *tint, ColorFilter *f, Palette *pal)
    302294{
     
    305297}
    306298
    307 void TransImage::PutColor(image *screen, ivec2 pos, uint8_t color)
     299void TransImage::PutColor(AImage *screen, ivec2 pos, uint8_t color)
    308300{
    309301    PutImageGeneric<COLOR>(screen, pos, color, NULL, ivec2(0), NULL, NULL,
     
    313305// This method is unused but is believed to work.
    314306// Assumes that the blend image completely covers the transparent image.
    315 void TransImage::PutBlend(image *screen, ivec2 pos, image *blend, ivec2 bpos,
     307void TransImage::PutBlend(AImage *screen, ivec2 pos, AImage *blend, ivec2 bpos,
    316308                          int amount, ColorFilter *f, Palette *pal)
    317309{
     
    320312}
    321313
    322 void TransImage::PutFilled(image *screen, ivec2 pos, uint8_t color)
     314void TransImage::PutFilled(AImage *screen, ivec2 pos, uint8_t color)
    323315{
    324316    PutImageGeneric<FILLED>(screen, pos, color, NULL, ivec2(0), NULL, NULL,
     
    326318}
    327319
    328 void TransImage::PutPredator(image *screen, ivec2 pos)
     320void TransImage::PutPredator(AImage *screen, ivec2 pos)
    329321{
    330322    PutImageGeneric<PREDATOR>(screen, pos, 0, NULL, ivec2(0), NULL, NULL,
     
    332324}
    333325
    334 void TransImage::PutScanLine(image *screen, ivec2 pos, int line)
     326void TransImage::PutScanLine(AImage *screen, ivec2 pos, int line)
    335327{
    336328    PutImageGeneric<SCANLINE>(screen, pos, 0, NULL, ivec2(0), NULL, NULL,
  • abuse/branches/lol/src/imlib/transimage.h

    r694 r709  
    2828{
    2929public:
    30     TransImage(image *im, char const *name);
     30    TransImage(AImage *im, char const *name);
    3131    ~TransImage();
    3232
     
    3434    inline uint8_t *Data() { return m_data; }
    3535
    36     image *ToImage();
     36    AImage *ToImage();
    3737
    38     void PutImage(image *screen, ivec2 pos);
    39     void PutRemap(image *screen, ivec2 pos, uint8_t *map);
    40     void PutDoubleRemap(image *screen, ivec2 pos, uint8_t *map, uint8_t *map2);
    41     void PutFade(image *screen, ivec2 pos, int amount, int nframes,
     38    void PutImage(AImage *screen, ivec2 pos);
     39    void PutRemap(AImage *screen, ivec2 pos, uint8_t *map);
     40    void PutDoubleRemap(AImage *screen, ivec2 pos, uint8_t *map, uint8_t *map2);
     41    void PutFade(AImage *screen, ivec2 pos, int amount, int nframes,
    4242                 ColorFilter *f, Palette *pal);
    43     void PutFadeTint(image *screen, ivec2 pos, int amount, int nframes,
     43    void PutFadeTint(AImage *screen, ivec2 pos, int amount, int nframes,
    4444                     uint8_t *tint, ColorFilter *f, Palette *pal);
    45     void PutColor(image *screen, ivec2 pos, uint8_t color);
    46     void PutFilled(image *screen, ivec2 pos, uint8_t color);
    47     void PutPredator(image *screen, ivec2 pos);
    48     void PutBlend(image *screen, ivec2 pos, image *blend, ivec2 bpos,
     45    void PutColor(AImage *screen, ivec2 pos, uint8_t color);
     46    void PutFilled(AImage *screen, ivec2 pos, uint8_t color);
     47    void PutPredator(AImage *screen, ivec2 pos);
     48    void PutBlend(AImage *screen, ivec2 pos, AImage *blend, ivec2 bpos,
    4949                  int blend_amount, ColorFilter *f, Palette *pal);
    50     void PutScanLine(image *screen, ivec2 pos, int line);
     50    void PutScanLine(AImage *screen, ivec2 pos, int line);
    5151
    5252    size_t DiskUsage();
    5353
    5454private:
    55     uint8_t *ClipToLine(image *screen, ivec2 pos1, ivec2 pos2,
     55    uint8_t *ClipToLine(AImage *screen, ivec2 pos1, ivec2 pos2,
    5656                        ivec2 &posy, int &ysteps);
    5757
     
    5959                   FILLED, PREDATOR, BLEND, SCANLINE };
    6060    template<int N>
    61     void PutImageGeneric(image *dest, ivec2 pos, uint8_t color,
    62                          image *blend, ivec2 bpos,
     61    void PutImageGeneric(AImage *dest, ivec2 pos, uint8_t color,
     62                         AImage *blend, ivec2 bpos,
    6363                         uint8_t *map1, uint8_t *map2, int amount,
    6464                         int nframes, uint8_t *tint,
  • abuse/branches/lol/src/imlib/video.cpp

    r700 r709  
    2020#include "video.h"
    2121
    22 void update_dirty(image *im, int xoff, int yoff)
     22void update_dirty(AImage *im, int xoff, int yoff)
    2323{
    2424    // make sure the image has the ability to contain dirty areas
     
    4949}
    5050
    51 void put_image(image * im, int x, int y)
     51void put_image(AImage * im, int x, int y)
    5252{
    5353    put_part_image(im, x, y, 0, 0, im->Size().x - 1, im->Size().y - 1);
  • abuse/branches/lol/src/imlib/video.h

    r708 r709  
    2929extern int xres,yres;
    3030extern int xoff,yoff;
    31 extern image *main_screen;
     31extern AImage *main_screen;
    3232
    3333void CreateScreen(int argc, char **argv);
     
    3535void UpdateScreen();
    3636
    37 void update_dirty(image *im, int xoff=0, int yoff=0);
    38 void put_part_image(image *im, int x, int y, int x1, int y1, int x2, int y2);
    39 void put_image(image * im, int x, int y);
     37void update_dirty(AImage *im, int xoff=0, int yoff=0);
     38void put_part_image(AImage *im, int x, int y, int x1, int y1, int x2, int y2);
     39void put_image(AImage * im, int x, int y);
    4040
    41 void clear_put_image(image *im, int x, int y);
     41void clear_put_image(AImage *im, int x, int y);
    4242int get_vmode();
    4343
  • abuse/branches/lol/src/imlib/visobj.h

    r605 r709  
    1818{
    1919public:
    20     virtual void draw(image *screen, int x, int y, Filter *f) = 0;
     20    virtual void draw(AImage *screen, int x, int y, Filter *f) = 0;
    2121    virtual int width() = 0;
    2222    virtual int height() = 0;
  • abuse/branches/lol/src/items.cpp

    r703 r709  
    214214{
    215215    uint8_t *sl;
    216     image *img = load_image(fp);
     216    AImage *img = load_image(fp);
    217217
    218218    // create the micro image of the fore tile by averaging the color values
     
    254254    }
    255255  }
    256   micro_image = new image(ivec2(AUTOTILE_WIDTH, AUTOTILE_HEIGHT));
     256  micro_image = new AImage(ivec2(AUTOTILE_WIDTH, AUTOTILE_HEIGHT));
    257257
    258258  for (l=0; l<AUTOTILE_WIDTH*AUTOTILE_HEIGHT; l++)
     
    284284figure::figure(bFILE *fp, int type)
    285285{
    286   image *im=load_image(fp);
     286  AImage *im=load_image(fp);
    287287  forward=new TransImage(im,"figure data");
    288288  im->FlipX();
  • abuse/branches/lol/src/items.h

    r689 r709  
    3434public :
    3535  uint16_t next;
    36   image *im;
     36  AImage *im;
    3737  backtile(SpecEntry *e, bFILE *fp);
    3838  backtile(bFILE *fp);
     
    5151  boundary *points;
    5252
    53   image *micro_image;
     53  AImage *micro_image;
    5454
    5555  foretile(bFILE *fp);
  • abuse/branches/lol/src/level.cpp

    r695 r709  
    15931593}
    15941594
    1595 void scale_put(image *im, image *screen, int x, int y, short new_width, short new_height);
    1596 
    1597 void Level::write_thumb_nail(bFILE *fp, image *im)
    1598 {
    1599   image *i = new image(ivec2(160, 100 + wm->font()->Size().y * 2));
     1595void scale_put(AImage *im, AImage *screen, int x, int y, short new_width, short new_height);
     1596
     1597void Level::write_thumb_nail(bFILE *fp, AImage *im)
     1598{
     1599  AImage *i = new AImage(ivec2(160, 100 + wm->font()->Size().y * 2));
    16001600  i->clear();
    16011601  scale_put(im,i,0,0,160,100);
     
    16131613  fp->write_uint16(i->Size().y);
    16141614
    1615   i->Lock();
    16161615  for(int y = 0; y < i->Size().y; y++)
    16171616    fp->write(i->scan_line(y),i->Size().x);
    1618   i->Unlock();
    16191617
    16201618  delete i;
  • abuse/branches/lol/src/level.h

    r691 r709  
    143143  void write_objects(bFILE *fp, object_node *save_list);
    144144  void write_options(bFILE *fp);
    145   void write_thumb_nail(bFILE *fp, image *im);
     145  void write_thumb_nail(bFILE *fp, AImage *im);
    146146  void write_cache_prof_info();
    147147  void restart();
  • abuse/branches/lol/src/light.cpp

    r706 r709  
    626626
    627627
    628 void light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient)
     628void light_screen(AImage *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient)
    629629{
    630630  int lx_run=0,ly_run;                     // light block x & y run size in pixels ==  (1<<lx_run)
     
    669669
    670670  LightPatch *f=first;
    671 
    672   main_screen->Lock();
    673671
    674672  int scr_w=main_screen->Size().x;
     
    765763    screen_line-=prefix;
    766764  }
    767   main_screen->Unlock();
    768765
    769766  while (first)
  • abuse/branches/lol/src/light.h

    r704 r709  
    7171void read_lights(SpecDir *sd, bFILE *fp, char const *level_name);
    7272
    73 void light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient);
     73void light_screen(AImage *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient);
    7474
    7575void calc_light_table(Palette *pal);
  • abuse/branches/lol/src/loader2.cpp

    r706 r709  
    7373
    7474
    75 image *load_image(SpecEntry *e, bFILE *fp)
    76 {
    77     image *im = new image(fp, e);
     75AImage *load_image(SpecEntry *e, bFILE *fp)
     76{
     77    AImage *im = new AImage(fp, e);
    7878    return im;
    7979}
    8080
    81 image *load_image(bFILE *fp)
    82 {
    83     image *im = new image(fp);
     81AImage *load_image(bFILE *fp)
     82{
     83    AImage *im = new AImage(fp);
    8484    return im;
    8585}
     
    352352
    353353
    354   image *tmp_image = new image(ivec2(192, 104), fnt6x13);
    355   big_font=new JCFont(tmp_image);
     354  AImage *tmp_image = new AImage(ivec2(192, 104));
     355  memcpy(tmp_image->scan_line(0), fnt6x13, 192 * 104);
     356  big_font = new JCFont(tmp_image);
    356357  delete tmp_image;
    357358
  • abuse/branches/lol/src/loader2.h

    r694 r709  
    7979
    8080
    81 image *load_image(SpecEntry *e, bFILE *fp);      // preforms scaling
    82 image *load_image(bFILE *fp);
     81AImage *load_image(SpecEntry *e, bFILE *fp);      // preforms scaling
     82AImage *load_image(bFILE *fp);
    8383void load_data(int argc, char **argv);
    8484char *load_script(char *name);
  • abuse/branches/lol/src/loadgame.cpp

    r689 r709  
    6060}
    6161
    62 Jwindow *create_num_window(int mx, int total_saved, int lines, image **thumbnails)
     62Jwindow *create_num_window(int mx, int total_saved, int lines, AImage **thumbnails)
    6363{
    6464  ico_button *buts[MAX_SAVE_GAMES];
     
    167167{
    168168    int total_saved=0;
    169     image *thumbnails[MAX_SAVE_GAMES];
     169    AImage *thumbnails[MAX_SAVE_GAMES];
    170170    int start_num=0;
    171171    int max_w=160,max_h=100;
    172172    memset(thumbnails,0,sizeof(thumbnails));
    173173
    174     image *first=NULL;
     174    AImage *first=NULL;
    175175
    176176    for (start_num=0; start_num<MAX_SAVE_GAMES; start_num++)
     
    191191            if (se && se->type==SPEC_IMAGE)
    192192            {
    193                 thumbnails[start_num] = new image(fp, se);
     193                thumbnails[start_num] = new AImage(fp, se);
    194194                if (thumbnails[start_num]->Size().x>max_w) max_w=thumbnails[start_num]->Size().x;
    195195                if (thumbnails[start_num]->Size().y>max_h) max_h=thumbnails[start_num]->Size().y;
     
    202202        if (fail && show_all)
    203203        {
    204             thumbnails[start_num] = new image(ivec2(160, 100));
     204            thumbnails[start_num] = new AImage(ivec2(160, 100));
    205205            thumbnails[start_num]->clear();
    206206            console_font->PutString(thumbnails[start_num], ivec2(0), symbol_str("no_saved"));
  • abuse/branches/lol/src/menu.cpp

    r707 r709  
    5656    percent = 256 - percent;
    5757
    58     main_screen->Lock();
    5958    for (int y = aa.y; y < bb.y; y++)
    6059    {
     
    6867    }
    6968    main_screen->AddDirty(aa, bb);
    70     main_screen->Unlock();
    7169}
    7270
     
    154152  int choice=0,done=0;
    155153  int bh=font->Size().y+3;
    156   image *save = new image(ivec2(mw - 2,bh));
     154  AImage *save = new AImage(ivec2(mw - 2,bh));
    157155  int color=128,cdir=50;
    158156
     
    352350
    353351void fade_out(int steps);
    354 void fade_in(image *im, int steps);
     352void fade_in(AImage *im, int steps);
    355353
    356354
     
    371369  if (DEFINEDP(ss->GetValue()))
    372370  {
    373     image blank(ivec2(2, 2)); blank.clear();
     371    AImage blank(ivec2(2, 2)); blank.clear();
    374372    wm->SetMouseShape(blank.copy(), ivec2(0, 0));      // don't show mouse
    375373
     
    490488      if (title_screen>=0)
    491489      {
    492         image *im = cache.img(title_screen);
     490        AImage *im = cache.img(title_screen);
    493491        main_screen->PutImage(im, main_screen->Size() / 2 - im->Size() / 2);
    494492      }
  • abuse/branches/lol/src/morpher.cpp

    r694 r709  
    6868      figure *f1=t1->get_sequence(morph_pose)->get_figure(0),
    6969      *f2=t2->get_sequence(morph_pose)->get_figure(0);
    70       image *i1=f1->forward->ToImage(),
     70      AImage *i1=f1->forward->ToImage(),
    7171      *i2=f2->forward->ToImage();
    7272
  • abuse/branches/lol/src/netcfg.cpp

    r706 r709  
    262262void net_configuration::error(char const *message)
    263263{
    264   image *screen_backup = main_screen->copy();
    265 
    266   image *ns=cache.img(cache.reg("art/frame.spe","net_screen",SPEC_IMAGE,1));
     264  AImage *screen_backup = main_screen->copy();
     265
     266  AImage *ns=cache.img(cache.reg("art/frame.spe","net_screen",SPEC_IMAGE,1));
    267267  int ns_w=ns->Size().x,ns_h=ns->Size().y;
    268268  int x=(xres+1)/2-ns_w/2,y=(yres+1)/2-ns_h/2;
     
    329329int net_configuration::get_options(int server)
    330330{
    331   image *ns=cache.img(cache.reg("art/frame.spe","net_screen",SPEC_IMAGE,1));
     331  AImage *ns=cache.img(cache.reg("art/frame.spe","net_screen",SPEC_IMAGE,1));
    332332  int ns_w=ns->Size().x,ns_h=ns->Size().y;
    333333  int x=(xres+1)/2-ns_w/2,y=(yres+1)/2-ns_h/2;
    334334  main_screen->PutImage(ns, ivec2(x, y));
    335335  JCFont *fnt=wm->font();
    336   image *ok_image=cache.img(cache.reg("art/frame.spe","dev_ok",SPEC_IMAGE,1))->copy(),
     336  AImage *ok_image=cache.img(cache.reg("art/frame.spe","dev_ok",SPEC_IMAGE,1))->copy(),
    337337    *cancel_image=cache.img(cache.reg("art/frame.spe","cancel",SPEC_IMAGE,1))->copy();
    338338
     
    448448  main_screen->clear();
    449449
    450   image *ns=cache.img(cache.reg("art/frame.spe","net_screen",SPEC_IMAGE,1));
     450  AImage *ns=cache.img(cache.reg("art/frame.spe","net_screen",SPEC_IMAGE,1));
    451451  int ns_w=ns->Size().x,ns_h=ns->Size().y;
    452452  int x=(xres+1)/2-ns_w/2,y=(yres+1)/2-ns_h/2;
  • abuse/branches/lol/src/particle.cpp

    r698 r709  
    163163}
    164164
    165 void part_frame::draw(image *screen, int x, int y, int dir)
     165void part_frame::draw(AImage *screen, int x, int y, int dir)
    166166{
    167167    ivec2 caa, cbb;
     
    178178  while (i && pon->y<caa.y) { pon++; i--; }
    179179  if (!i) return ;
    180   screen->Lock();
    181180  if (dir>0)
    182181  {
     
    200199    }
    201200  }
    202   screen->Unlock();
    203201}
    204202
     
    218216    s = (15 - s);
    219217
    220     main_screen->Lock();
    221218    while(t--)
    222219    {
     
    230227        yo += dy;
    231228    }
    232     main_screen->Unlock();
    233229}
    234230
     
    247243    int ym = (1 << s);
    248244    s = (15 - s);
    249 
    250     main_screen->Lock();
    251245
    252246    int w = main_screen->Size().x;
     
    271265        yo += dy;
    272266    }
    273 
    274     main_screen->Unlock();
    275 }
    276 
     267}
     268
  • abuse/branches/lol/src/particle.h

    r691 r709  
    3838  part *data;
    3939  part_frame(bFILE *fp);
    40   void draw(image *screen, int x, int y, int dir);
     40  void draw(AImage *screen, int x, int y, int dir);
    4141  ~part_frame();
    4242} ;
  • abuse/branches/lol/src/sbar.h

    r555 r709  
    3232
    3333  void area(int &x1, int &y1, int &x2, int &y2);
    34   void draw_num(image *screen, int x, int y, int num, int *offset);
     34  void draw_num(AImage *screen, int x, int y, int num, int *offset);
    3535  int mouse_in_area();
    3636  public :
     
    3838  void associate(view *V) { v=V; }
    3939  void load();                     // load graphics into cache
    40   void redraw(image *screen);
     40  void redraw(AImage *screen);
    4141
    4242  void step();
    43   void draw_health(image *screen,int amount);
    44   void draw_ammo(image *screen, int weapon_num, int amount, int light);
     43  void draw_health(AImage *screen,int amount);
     44  void draw_ammo(AImage *screen, int weapon_num, int amount, int light);
    4545  void need_refresh() { need_rf=1; }
    4646  void draw_update();
  • abuse/branches/lol/src/sdlport/event.cpp

    r706 r709  
    3535
    3636extern int get_key_binding(char const *dir, int i);
    37 extern int mouse_xscale, mouse_yscale;
    3837short mouse_buttons[5] = { 0, 0, 0, 0, 0 };
    39 
    40 void EventHandler::SysInit()
    41 {
    42     // Ignore activate events
    43     SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE);
    44 }
    4538
    4639void EventHandler::SysWarpMouse(ivec2 pos)
  • abuse/branches/lol/src/sdlport/video.cpp

    r708 r709  
    4242Array<uint8_t> g_screen;
    4343
    44 image *main_screen = NULL;
     44AImage *main_screen = NULL;
    4545int mouse_xscale, mouse_yscale;
    4646int xres, yres;
     
    6262
    6363    // Create the screen image
    64     main_screen = new image(ivec2(xres, yres), NULL, 2);
     64    main_screen = new AImage(ivec2(xres, yres), 2);
    6565    if (main_screen == NULL)
    6666    {
     
    9090// Draw only dirty parts of the image to screen
    9191//
    92 void put_part_image(image *im, int x, int y, int x1, int y1, int x2, int y2)
     92void put_part_image(AImage *im, int x, int y, int x1, int y1, int x2, int y2)
    9393{
    9494    int xe, ye;
  • abuse/branches/lol/src/statbar.cpp

    r703 r709  
    3737
    3838// defined in dev.c
    39 void scale_put_trans(image *im, image *screen, int x, int y, short new_width, short new_height);
    40 void scale_put(image *im, image *screen, int x, int y, short new_width, short new_height);
     39void scale_put_trans(AImage *im, AImage *screen, int x, int y, short new_width, short new_height);
     40void scale_put(AImage *im, AImage *screen, int x, int y, short new_width, short new_height);
    4141
    4242void status_bar::load()
     
    7171}
    7272
    73 void status_bar::draw_num(image *screen, int x, int y, int num, int *offset)
     73void status_bar::draw_num(AImage *screen, int x, int y, int num, int *offset)
    7474{
    7575  if (num<0 || num>999)
     
    7979  }
    8080
    81   image *im=cache.img(*offset);
     81  AImage *im=cache.img(*offset);
    8282  int dw = im->Size().x;
    8383  int dh = im->Size().y;
     
    9595}
    9696
    97 void status_bar::redraw(image *screen)
     97void status_bar::redraw(AImage *screen)
    9898{
    9999  need_rf=0;
     
    104104    if (!playing_state(the_game->state)) return ;
    105105
    106     image *sb=cache.img(sbar);
     106    AImage *sb=cache.img(sbar);
    107107
    108108    // status bar width & height
     
    174174  }
    175175
    176   image *sb=cache.img(sbar);
     176  AImage *sb=cache.img(sbar);
    177177
    178178  // status bar width & height
     
    187187
    188188
    189 void status_bar::draw_health(image *screen,int amount)
     189void status_bar::draw_health(AImage *screen,int amount)
    190190{
    191191  if (total_weapons)
     
    198198
    199199
    200 void status_bar::draw_ammo(image *screen, int weapon_num, int amount, int light)
     200void status_bar::draw_ammo(AImage *screen, int weapon_num, int amount, int light)
    201201{
    202202  if (total_weapons)
     
    259259  if (sbar>0 && total_weapons)
    260260  {
    261     image *sb=cache.img(sbar);
     261    AImage *sb=cache.img(sbar);
    262262
    263263    // status bar width & height
  • abuse/branches/lol/src/tool/abuse-tool.cpp

    r698 r709  
    146146            case SPEC_CHARACTER2:
    147147              {
    148                 image *im = new image(&fp, se);
     148                AImage *im = new AImage(&fp, se);
    149149                printf(" \t# %i x %i pixels", im->Size().x, im->Size().y);
    150150                delete im;
     
    242242            pal = new Palette(dir.m_entries[palid], &fp);
    243243
    244         image *im = new image(&fp, dir.m_entries[imgid]);
     244        AImage *im = new AImage(&fp, dir.m_entries[imgid]);
    245245        write_PCX(im, pal, "/dev/stdout");
    246246        delete im;
     
    338338        {
    339339            Palette *pal = NULL;
    340             image *im = read_PCX(argv[5], pal);
     340            AImage *im = read_PCX(argv[5], pal);
    341341            if (!im)
    342342            {
  • abuse/branches/lol/src/transp.cpp

    r687 r709  
    1717#include "transp.h"
    1818
    19 void transp_put(image *im, image *screen, uint8_t *table, int x, int y)
     19void transp_put(AImage *im, AImage *screen, uint8_t *table, int x, int y)
    2020{
    2121    ivec2 caa, cbb;
     
    5656
    5757/*
    58 void transp_put(image *im, image *screen, uint8_t *table, int x, int y)
     58void transp_put(AImage *im, AImage *screen, uint8_t *table, int x, int y)
    5959{
    6060  int cx1, cy1, cx2, cy2;
  • abuse/branches/lol/src/transp.h

    r555 r709  
    1212#define __TRANSP_HPP_
    1313#include "image.h"
    14 void transp_put(image *im, image *screen, uint8_t *table, int x, int y);
     14void transp_put(AImage *im, AImage *screen, uint8_t *table, int x, int y);
    1515
    1616#endif
  • abuse/branches/lol/src/ui/volumewindow.cpp

    r694 r709  
    4343    bg = cache.reg(ff, "vcontrol", SPEC_IMAGE, 1);
    4444    m_size = cache.img(bg)->Size();
    45     m_surf = new image(m_size, NULL, 2);
     45    m_surf = new AImage(m_size, 2);
    4646    redraw();
    4747}
Note: See TracChangeset for help on using the changeset viewer.