/[projectaxis]/projectaxis/projectAxis/src/visual/renderman.cpp
ViewVC logotype

Diff of /projectaxis/projectAxis/src/visual/renderman.cpp

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

revision 1.6 by leiavoia, Sun Sep 14 01:05:00 2003 UTC revision 1.7 by vovansim, Sat Sep 20 03:34:06 2003 UTC
# Line 65  RenderMan::RenderMan(int x, int y, bool Line 65  RenderMan::RenderMan(int x, int y, bool
65          // 0 - use screen bitdepth          // 0 - use screen bitdepth
66          // SDL_SWSURFACE - PG_ option to generate surface in system memory          // SDL_SWSURFACE - PG_ option to generate surface in system memory
67          if (fullscreen == 0) {          if (fullscreen == 0) {
68                  app->InitScreen(XRES, YRES, 0, SDL_SWSURFACE);                  app->InitScreen(XRES, YRES, 16, SDL_SWSURFACE);
69                  }                  }
70          else {          else {
71                  app->InitScreen(XRES, YRES, 0, SDL_SWSURFACE | SDL_FULLSCREEN);                  app->InitScreen(XRES, YRES, 16, SDL_SWSURFACE | SDL_FULLSCREEN);
72                  }                  }
73    
74          // the master widget - every other widget is a child of this          // the master widget - every other widget is a child of this
# Line 227  void RenderMan::DrawIMG(SDL_Surface *fro Line 227  void RenderMan::DrawIMG(SDL_Surface *fro
227  // draws a pixel of specified RGB value onto a surface  // draws a pixel of specified RGB value onto a surface
228  void RenderMan::DrawPixel(SDL_Surface *s, int x, int y, Uint8 R, Uint8 G, Uint8 B) {  void RenderMan::DrawPixel(SDL_Surface *s, int x, int y, Uint8 R, Uint8 G, Uint8 B) {
229          Uint32 color = SDL_MapRGB(s->format, R, G, B);          Uint32 color = SDL_MapRGB(s->format, R, G, B);
230          switch (s->format->BytesPerPixel) {          switch (s->format->BytesPerPixel) {
231                  case 1: {// Assuming 8-bpp                          case 1: {// Assuming 8-bpp
232                          Uint8 *bufp;                                  Uint8 *bufp;
233                          bufp = (Uint8 *)s->pixels + y*s->pitch + x;                                  bufp = (Uint8 *)s->pixels + y*s->pitch + x;
234                          *bufp = color;                                  *bufp = color;
235                          break;                                  break;
236                          }                                          }
237                  case 2: {// Probably 15-bpp or 16-bpp                          case 2: {// Probably 15-bpp or 16-bpp
238                          Uint16 *bufp;                                  Uint16 *bufp;
239                          bufp = (Uint16 *)s->pixels + y*s->pitch/2 + x;                                  bufp = (Uint16 *)s->pixels + y*s->pitch/2 + x;
240                          *bufp = color;                                  *bufp = color;
241                          break;                                  break;
242                          }                                          }
243                  case 3: {// Slow 24-bpp mode, usually not used                          case 3: {// Slow 24-bpp mode, usually not used
244                          Uint8 *bufp;                                  Uint8 *bufp;
245                          bufp = (Uint8 *)s->pixels + y*s->pitch + x * 3;                                  bufp = (Uint8 *)s->pixels + y*s->pitch + x * 3;
246                           if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {                                  if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {
247                                  bufp[0] = color;                                          bufp[0] = color;
248                                  bufp[1] = color >> 8;                                          bufp[1] = color >> 8;
249                                  bufp[2] = color >> 16;                                          bufp[2] = color >> 16;
250                                  }                                  }
251                          else {                                  else {
252                                  bufp[2] = color;                                          bufp[2] = color;
253                                  bufp[1] = color >> 8;                                          bufp[1] = color >> 8;
254                                  bufp[0] = color >> 16;                                          bufp[0] = color >> 16;
255                                  }                                  }
256                          break;                                  break;
257                          }                                          }
258                   case 4: {// Probably 32-bpp                          case 4: {// Probably 32-bpp
259                          Uint32 *bufp;                                  Uint32 *bufp;
260                          bufp = (Uint32 *)s->pixels + y*s->pitch/4 + x;                                  bufp = (Uint32 *)s->pixels + y*s->pitch/4 + x;
261                          *bufp = color;                                  *bufp = color;
262                          break;                                  break;
263                          }                                          }
                 }  
264          }          }
265    }
266  // Basic drawing functions ---------------/\---------------------  // Basic drawing functions ---------------/\---------------------
267    
268    

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

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