/[adonthell]/adonthell-0.3/src/image.cc
ViewVC logotype

Diff of /adonthell-0.3/src/image.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by ksterker, Wed Dec 4 17:09:48 2002 UTC revision 1.16 by ksterker, Mon Oct 25 06:55:01 2004 UTC
# Line 1  Line 1 
1  /*  /*
2     $Id$     $Id$
3    
4     Copyright (C) 1999/2000/2001/2002 Alexandre Courbot     Copyright (C) 1999/2000/2001/2002/2004 Alexandre Courbot
5     Part of the Adonthell Project http://adonthell.linuxgames.com     Part of the Adonthell Project http://adonthell.linuxgames.com
6    
7     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
# Line 44  image::image () : surface () Line 44  image::image () : surface ()
44  {  {
45  }  }
46    
47  image::image (u_int16 l, u_int16 h) : surface ()  image::image (u_int16 l, u_int16 h, bool mode) : surface (mode)
48  {  {
49      resize (l, h);      resize (l, h);
50  }  }
51    
52    image::image (SDL_Surface *s, const SDL_Color & color) : surface (false)
53    {
54        if (screen::dbl_mode ()) {
55            set_length (s->w >> 1);
56            set_height (s->h >> 1);
57        } else {
58            set_length (s->w);
59            set_height (s->h);
60        }
61        
62        vis = SDL_DisplayFormat (s);
63        SDL_SetColorKey (vis, SDL_SRCCOLORKEY | SDL_RLEACCEL,
64            SDL_MapRGB (vis->format, color.r, color.g, color.b));
65        SDL_FreeSurface (s);
66        changed = false;
67    }
68    
69  image::~image ()  image::~image ()
70  {  {
71  }  }
# Line 204  s_int8 image::put_raw (ogzstream& file) Line 221  s_int8 image::put_raw (ogzstream& file)
221      image * imt;      image * imt;
222      SDL_Surface * toconvert;      SDL_Surface * toconvert;
223            
224      if (screen::dblmode)      if (dbl_mode)
225      {      {
226          imt = new image();          imt = new image();
227          imt->double_size(*this);          imt->double_size(*this);
# Line 230  s_int8 image::put_raw (ogzstream& file) Line 247  s_int8 image::put_raw (ogzstream& file)
247    
248      SDL_FreeSurface (temp);      SDL_FreeSurface (temp);
249      SDL_FreeSurface (tmp2);      SDL_FreeSurface (tmp2);
250      if (screen::dblmode) delete imt;      if (dbl_mode) delete imt;
251      return 0;      return 0;
252  }  }
253    
# Line 254  s_int8 image::put_pnm (SDL_RWops * file) Line 271  s_int8 image::put_pnm (SDL_RWops * file)
271            
272      SDL_Surface * temp;      SDL_Surface * temp;
273    
274      if (screen::dblmode)      if (dbl_mode)
275      {      {
276          image imt;          image imt;
277          imt.half_size(*this);          imt.half_size(*this);
# Line 338  void image::brightness (const surface& s Line 355  void image::brightness (const surface& s
355      u_int8 ir, ig, ib;      u_int8 ir, ig, ib;
356      u_int32 temp = 0;      u_int32 temp = 0;
357            
358      resize (src.length (), src.height ());      if (screen::dbl_mode () && !dbl_mode) resize (src.length () << 1, src.height () << 1);
359        else resize (src.length (), src.height ());
360        
361      lock ();      lock ();
362      src.lock ();      src.lock ();
363      for (j = 0; j < height (); j++)      for (j = 0; j < height (); j++)
# Line 386  void image::raw2display (void * rawdata, Line 405  void image::raw2display (void * rawdata,
405                                                    R_MASK, G_MASK,                                                    R_MASK, G_MASK,
406                                                    B_MASK, 0);                                                    B_MASK, 0);
407      vis = SDL_DisplayFormat (tmp2);      vis = SDL_DisplayFormat (tmp2);
408      if (screen::dblmode)      if (dbl_mode)
409      {      {
410          image imt;          image imt;
411          imt.double_size(*this);          imt.double_size(*this);

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26