/[paragui]/paragui/src/draw/drawline.cpp
ViewVC logotype

Diff of /paragui/src/draw/drawline.cpp

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

revision 1.3 by braindead, Mon Apr 15 13:35:35 2002 UTC revision 1.3.8.1 by braindead, Mon Nov 24 09:17:21 2003 UTC
# Line 30  Line 30 
30    
31  #include "pgdraw.h"  #include "pgdraw.h"
32    
33  void plotpixel(SDL_Surface* surface, Uint32 x, Uint32 y, const SDL_Color& c, Uint8 width, int *pixelflag) {  void plotpixel(SDL_Surface* surface, Uint32 x, Uint32 y, const PG_Color& c, Uint8 width, int *pixelflag) {
34          Uint32 xp, yp, xf, yf;          Uint32 xp, yp, xf, yf;
35          static Uint32 oldx, oldy;          static Uint32 oldx, oldy;
36    
# Line 39  void plotpixel(SDL_Surface* surface, Uin Line 39  void plotpixel(SDL_Surface* surface, Uin
39            
40          //      width=1? Only need to draw 1 pixel          //      width=1? Only need to draw 1 pixel
41          if(width==1) {          if(width==1) {
42                  PG_Draw::SetPixel(x, y, c.r, c.g, c.b, surface);                  PG_Draw::SetPixel(x, y, c, surface);
43          } else {          } else {
44    
45                  //      calculate new pixel position (shifts are faster)                  //      calculate new pixel position (shifts are faster)
# Line 54  void plotpixel(SDL_Surface* surface, Uin Line 54  void plotpixel(SDL_Surface* surface, Uin
54                          //      draw all pixels needed                          //      draw all pixels needed
55                          for (xf=0; xf<width; xf++) {                          for (xf=0; xf<width; xf++) {
56                                  for (yf=0; yf<width; yf++) {                                  for (yf=0; yf<width; yf++) {
57                                          PG_Draw::SetPixel(xf+xp, yf+yp, c.r, c.g, c.b, surface);                                          PG_Draw::SetPixel(xf+xp, yf+yp, c, surface);
58                                  }                                  }
59                          }                          }
60                  }                  }
# Line 67  void plotpixel(SDL_Surface* surface, Uin Line 67  void plotpixel(SDL_Surface* surface, Uin
67    
68                                  //      only need to draw the bottom pixels                                  //      only need to draw the bottom pixels
69                                  for (xf=0; xf<width; xf++) {                                  for (xf=0; xf<width; xf++) {
70                                          PG_Draw::SetPixel(xf+xp, yp-1+(width-1), c.r, c.g, c.b, surface);                                          PG_Draw::SetPixel(xf+xp, yp-1+(width-1), c, surface);
71                                  }                                  }
72                          }                          }
73    
# Line 75  void plotpixel(SDL_Surface* surface, Uin Line 75  void plotpixel(SDL_Surface* surface, Uin
75                          if (xp>oldx) {                          if (xp>oldx) {
76                                  //      only need to draw the most right pixels                                  //      only need to draw the most right pixels
77                                  for (yf=0; yf<width; yf++) {                                  for (yf=0; yf<width; yf++) {
78                                          PG_Draw::SetPixel(xp-1+(width-1), yp+yf, c.r, c.g, c.b, surface);                                          PG_Draw::SetPixel(xp-1+(width-1), yp+yf, c, surface);
79                                  }                                  }
80                          }                          }
81    
# Line 84  void plotpixel(SDL_Surface* surface, Uin Line 84  void plotpixel(SDL_Surface* surface, Uin
84    
85                                  //      only need to draw the most left pixels                                  //      only need to draw the most left pixels
86                                  for (yf=0; yf<width; yf++) {                                  for (yf=0; yf<width; yf++) {
87                                          PG_Draw::SetPixel(xp+1, yp+yf, c.r, c.g, c.b, surface);                                          PG_Draw::SetPixel(xp+1, yp+yf, c, surface);
88                                  }                                  }
89                          }                          }
90    
# Line 96  void plotpixel(SDL_Surface* surface, Uin Line 96  void plotpixel(SDL_Surface* surface, Uin
96  }  }
97    
98  void octant0(SDL_Surface* surface, Uint32 x0, Uint32 y0, Uint32 deltax, Uint32 deltay,  void octant0(SDL_Surface* surface, Uint32 x0, Uint32 y0, Uint32 deltax, Uint32 deltay,
99               int xdirection, const SDL_Color& color, Uint8 width, int pixelflag)               int xdirection, const PG_Color& color, Uint8 width, int pixelflag)
100  {  {
101          int deltay2;          int deltay2;
102          int error;          int error;
# Line 131  void octant0(SDL_Surface* surface, Uint3 Line 131  void octant0(SDL_Surface* surface, Uint3
131  } /* end of the function */  } /* end of the function */
132    
133  void octant1(SDL_Surface* surface, Uint32 x0, Uint32 y0, Uint32 deltax, Uint32 deltay,  void octant1(SDL_Surface* surface, Uint32 x0, Uint32 y0, Uint32 deltax, Uint32 deltay,
134               int xdirection, const SDL_Color& color, Uint8 width, int pixelflag)               int xdirection, const PG_Color& color, Uint8 width, int pixelflag)
135  {  {
136          int deltax2;          int deltax2;
137          int error;          int error;
# Line 166  void octant1(SDL_Surface* surface, Uint3 Line 166  void octant1(SDL_Surface* surface, Uint3
166    
167  } /* end of the function */  } /* end of the function */
168    
169  void PG_Draw::DrawLine(SDL_Surface* surface, Uint32 x0, Uint32 y0, Uint32 x1, Uint32 y1, const SDL_Color& color, Uint8 width) {  void PG_Draw::DrawLine(SDL_Surface* surface, Uint32 x0, Uint32 y0, Uint32 x1, Uint32 y1, const PG_Color& color, Uint8 width) {
170          int deltax;          int deltax;
171          int deltay;          int deltay;
172          int temp;          int temp;

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.3.8.1

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