Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

removed unessessary sdl_draw code

  • Loading branch information...
commit 6d540178391a6a213e41ca2871ceb518c538f2e5 1 parent 32523b5
sebseb7 authored December 17, 2011
109  firmware/sim/sdl_draw/Draw_Circle.c
... ...
@@ -1,109 +0,0 @@
1  
-/*!
2  
-  \file Draw_Circle.c
3  
-  \author Mario Palomo <mpalomo@ihman.com>
4  
-  \author Jose M. de la Huerga Fernández
5  
-  \author Pepe González Mora
6  
-  \date 05-2002
7  
-
8  
-  This library is free software; you can redistribute it and/or
9  
-  modify it under the terms of the GNU Library General Public
10  
-  License as published by the Free Software Foundation; either
11  
-  version 2 of the License, or (at your option) any later version.
12  
-
13  
-  This library is distributed in the hope that it will be useful,
14  
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  
-  Library General Public License for more details.
17  
-
18  
-  You should have received a copy of the GNU Library General Public
19  
-  License along with this library; if not, write to the Free Foundation,
20  
-  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  
-*/
22  
-
23  
-#define SDL_DRAW_PUTPIXEL_BPP(A, B, C)  \
24  
-*(A(B(Uint8*)super->pixels + (y0+y)*super->pitch +               \
25  
-                                          (x0+x)*SDL_DRAW_BPP)) = C; \
26  
-*(A(B(Uint8*)super->pixels + (y0-y)*super->pitch +               \
27  
-                                          (x0+x)*SDL_DRAW_BPP)) = C; \
28  
-*(A(B(Uint8*)super->pixels + (y0+y)*super->pitch +               \
29  
-                                          (x0-x)*SDL_DRAW_BPP)) = C; \
30  
-*(A(B(Uint8*)super->pixels + (y0-y)*super->pitch +               \
31  
-                                          (x0-x)*SDL_DRAW_BPP)) = C; \
32  
-*(A(B(Uint8*)super->pixels + (y0+x)*super->pitch +               \
33  
-                                          (x0+y)*SDL_DRAW_BPP)) = C; \
34  
-*(A(B(Uint8*)super->pixels + (y0-x)*super->pitch +               \
35  
-                                          (x0+y)*SDL_DRAW_BPP)) = C; \
36  
-*(A(B(Uint8*)super->pixels + (y0+x)*super->pitch +               \
37  
-                                          (x0-y)*SDL_DRAW_BPP)) = C; \
38  
-*(A(B(Uint8*)super->pixels + (y0-x)*super->pitch +               \
39  
-                                          (x0-y)*SDL_DRAW_BPP)) = C;
40  
-
41  
-#if SDL_DRAW_BPP == 1
42  
-#define SDL_DRAW_PUTPIXEL SDL_DRAW_PUTPIXEL_BPP(0+,0+,color)
43  
-
44  
-#elif SDL_DRAW_BPP == 2
45  
-#define SDL_DRAW_PUTPIXEL SDL_DRAW_PUTPIXEL_BPP((Uint16*),0+,color)
46  
-
47  
-#elif SDL_DRAW_BPP == 3
48  
-#define SDL_DRAW_PUTPIXEL \
49  
-  SDL_DRAW_PUTPIXEL_BPP(0+,1+,colorbyte1)   \
50  
-  if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {  \
51  
-    SDL_DRAW_PUTPIXEL_BPP(0+,0+,colorbyte2)   \
52  
-    SDL_DRAW_PUTPIXEL_BPP(0+,2+,colorbyte0) \
53  
-  }else{                                  \
54  
-    SDL_DRAW_PUTPIXEL_BPP(0+,0+,colorbyte0)   \
55  
-    SDL_DRAW_PUTPIXEL_BPP(0+,2+,colorbyte2) \
56  
-  }
57  
-
58  
-#elif SDL_DRAW_BPP == 4
59  
-#define SDL_DRAW_PUTPIXEL SDL_DRAW_PUTPIXEL_BPP((Uint32*),0+,color)
60  
-
61  
-#endif /*SDL_DRAW_BPP*/
62  
-
63  
-
64  
-void SDL_DRAWFUNCTION(SDL_Surface *super,
65  
-                      Sint16 x0, Sint16 y0, Uint16 r,
66  
-                      Uint32 color)
67  
-{
68  
-#if SDL_DRAW_BPP == 3
69  
-  Uint8 colorbyte0 = (Uint8) (color & 0xff);
70  
-  Uint8 colorbyte1 = (Uint8) ((color >> 8) & 0xff);
71  
-  Uint8 colorbyte2 = (Uint8) ((color >> 16) & 0xff);
72  
-#endif
73  
-
74  
-  Sint16 x = 0;
75  
-  Sint16 y = r-1;     /*radius zero == draw nothing*/
76  
-  Sint16 d = 3 - 2*r;
77  
-  Sint16 diagonalInc = 10 - 4*r;
78  
-  Sint16 rightInc = 6;
79  
-
80  
-  /* Lock surface */
81  
-  if (SDL_MUSTLOCK(super)) {
82  
-    if (SDL_LockSurface(super) < 0)  { return; }
83  
-  }
84  
-  
85  
-  while (x <= y) {
86  
-
87  
-    SDL_DRAW_PUTPIXEL
88  
-
89  
-    if (d >=  0) {
90  
-      d += diagonalInc;
91  
-      diagonalInc += 8;
92  
-      y -= 1;
93  
-    } else {
94  
-      d += rightInc;
95  
-      diagonalInc += 4;
96  
-    }
97  
-    rightInc += 4;
98  
-    x += 1;
99  
-  }
100  
-
101  
-  /* Unlock surface */
102  
-  if (SDL_MUSTLOCK(super))  { SDL_UnlockSurface(super); }
103  
-  
104  
-}/*Draw_Circle*/
105  
-
106  
-
107  
-#undef SDL_DRAW_PUTPIXEL
108  
-#undef SDL_DRAW_PUTPIXEL_BPP
109  
-
145  firmware/sim/sdl_draw/Draw_Ellipse.c
... ...
@@ -1,145 +0,0 @@
1  
-/*!
2  
-  \file Draw_Ellipse.c
3  
-  \author Mario Palomo <mpalomo@ihman.com>
4  
-  \author Jose M. de la Huerga Fernández
5  
-  \author Pepe González Mora
6  
-  \date 05-2002
7  
-
8  
-  This library is free software; you can redistribute it and/or
9  
-  modify it under the terms of the GNU Library General Public
10  
-  License as published by the Free Software Foundation; either
11  
-  version 2 of the License, or (at your option) any later version.
12  
-
13  
-  This library is distributed in the hope that it will be useful,
14  
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  
-  Library General Public License for more details.
17  
-
18  
-  You should have received a copy of the GNU Library General Public
19  
-  License along with this library; if not, write to the Free Foundation,
20  
-  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  
-*/
22  
-
23  
-#define SDL_DRAW_PUTPIXEL_BPP(A, B, C)  \
24  
-*(A(B(Uint8*)super->pixels + (y0+y)*super->pitch +               \
25  
-                                          (x0+x)*SDL_DRAW_BPP)) = C; \
26  
-*(A(B(Uint8*)super->pixels + (y0-y)*super->pitch +               \
27  
-                                          (x0+x)*SDL_DRAW_BPP)) = C; \
28  
-*(A(B(Uint8*)super->pixels + (y0+y)*super->pitch +               \
29  
-                                          (x0-x)*SDL_DRAW_BPP)) = C; \
30  
-*(A(B(Uint8*)super->pixels + (y0-y)*super->pitch +               \
31  
-                                          (x0-x)*SDL_DRAW_BPP)) = C;
32  
-
33  
-
34  
-#if SDL_DRAW_BPP == 1
35  
-#define SDL_DRAW_PUTPIXEL SDL_DRAW_PUTPIXEL_BPP(0+,0+,color)
36  
-
37  
-#elif SDL_DRAW_BPP == 2
38  
-#define SDL_DRAW_PUTPIXEL SDL_DRAW_PUTPIXEL_BPP((Uint16*),0+,color)
39  
-
40  
-#elif SDL_DRAW_BPP == 3
41  
-#define SDL_DRAW_PUTPIXEL \
42  
-  SDL_DRAW_PUTPIXEL_BPP(0+,1+,colorbyte1)   \
43  
-  if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {   \
44  
-    SDL_DRAW_PUTPIXEL_BPP(0+,0+,colorbyte2)   \
45  
-    SDL_DRAW_PUTPIXEL_BPP(0+,2+,colorbyte0) \
46  
-  }else{                                   \
47  
-    SDL_DRAW_PUTPIXEL_BPP(0+,0+,colorbyte0)   \
48  
-    SDL_DRAW_PUTPIXEL_BPP(0+,2+,colorbyte2) \
49  
-  }
50  
-
51  
-#elif SDL_DRAW_BPP == 4
52  
-#define SDL_DRAW_PUTPIXEL SDL_DRAW_PUTPIXEL_BPP((Uint32*),0+,color)
53  
-
54  
-#endif /*SDL_DRAW_BPP*/
55  
-
56  
-
57  
-void SDL_DRAWFUNCTION(SDL_Surface *super,
58  
-                      Sint16 x0, Sint16 y0,
59  
-                      Uint16 Xradius, Uint16 Yradius,
60  
-                      Uint32 color)
61  
-{
62  
-  Sint32 x, y;
63  
-  Sint32 Xchange, Ychange;
64  
-  Sint32 EllipseError;
65  
-  Sint32 TwoASquare, TwoBSquare;
66  
-  Sint32 StoppingX, StoppingY;
67  
-
68  
-#if SDL_DRAW_BPP == 3
69  
-  Uint8 colorbyte0 = (Uint8) (color & 0xff);
70  
-  Uint8 colorbyte1 = (Uint8) ((color >> 8)  & 0xff);
71  
-  Uint8 colorbyte2 = (Uint8) ((color >> 16) & 0xff);
72  
-#endif
73  
-
74  
-  TwoASquare = 2*Xradius*Xradius;
75  
-  TwoBSquare = 2*Yradius*Yradius;
76  
-
77  
-  /*1st set of points*/
78  
-  x = Xradius-1;  /*radius zero == draw nothing*/
79  
-  y = 0;
80  
-
81  
-  Xchange = Yradius*Yradius*(1-2*Xradius);
82  
-  Ychange = Xradius*Xradius;
83  
-
84  
-  EllipseError = 0;
85  
-
86  
-  StoppingX = TwoBSquare*Xradius;
87  
-  StoppingY = 0;
88  
-
89  
-  /* Lock surface */
90  
-  if (SDL_MUSTLOCK(super)) {
91  
-      if (SDL_LockSurface(super) < 0)  { return; }
92  
-  }
93  
-  
94  
-  /*Plot four ellipse points by iteration*/
95  
-  while (StoppingX > StoppingY) {
96  
-
97  
-    SDL_DRAW_PUTPIXEL
98  
-
99  
-    ++y;
100  
-    StoppingY    += TwoASquare;
101  
-    EllipseError += Ychange;
102  
-    Ychange      += TwoASquare;
103  
-    if (( 2*EllipseError + Xchange) > 0) {
104  
-      --x;
105  
-      StoppingX    -= TwoBSquare;
106  
-      EllipseError += Xchange;
107  
-      Xchange      += TwoBSquare;
108  
-    }
109  
-  }/*while*/
110  
-
111  
-  /*2nd set of points*/
112  
-  x = 0;
113  
-  y = Yradius-1;  /*radius zero == draw nothing*/
114  
-  Xchange = Yradius*Yradius;
115  
-  Ychange = Xradius*Xradius*(1-2*Yradius);
116  
-  EllipseError = 0;
117  
-  StoppingX = 0;
118  
-  StoppingY = TwoASquare*Yradius;
119  
-
120  
-  /*Plot four ellipse points by iteration*/
121  
-  while (StoppingX < StoppingY) {
122  
-
123  
-    SDL_DRAW_PUTPIXEL
124  
-
125  
-    ++x;
126  
-    StoppingX    += TwoBSquare;
127  
-    EllipseError += Xchange;
128  
-    Xchange      += TwoBSquare;
129  
-    if ((2*EllipseError + Ychange) > 0) {
130  
-      --y;
131  
-      StoppingY    -= TwoASquare;
132  
-      EllipseError += Ychange;
133  
-      Ychange      += TwoASquare;
134  
-    }
135  
-  }
136  
-
137  
-  /* Unlock surface */
138  
-  if (SDL_MUSTLOCK(super))  { SDL_UnlockSurface(super); }
139  
-  
140  
-}/*Draw_Ellipse*/
141  
-
142  
-
143  
-#undef SDL_DRAW_PUTPIXEL
144  
-#undef SDL_DRAW_PUTPIXEL_BPP
145  
-
226  firmware/sim/sdl_draw/Draw_FillEllipse.c
... ...
@@ -1,226 +0,0 @@
1  
-/*!
2  
-  \file Draw_FillEllipse.c
3  
-  \author Mario Palomo <mpalomo@ihman.com>
4  
-  \author Jose M. de la Huerga Fernández
5  
-  \author Pepe González Mora
6  
-  \date 05-2002
7  
-
8  
-  This library is free software; you can redistribute it and/or
9  
-  modify it under the terms of the GNU Library General Public
10  
-  License as published by the Free Software Foundation; either
11  
-  version 2 of the License, or (at your option) any later version.
12  
-
13  
-  This library is distributed in the hope that it will be useful,
14  
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  
-  Library General Public License for more details.
17  
-
18  
-  You should have received a copy of the GNU Library General Public
19  
-  License along with this library; if not, write to the Free Foundation,
20  
-  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  
-*/
22  
-
23  
-#if SDL_DRAW_BPP == 1
24  
-#define SDL_DRAW_PUTPIXEL \
25  
-  memset(((Uint8*)super->pixels+ (y0+y)*super->pitch+ (x0-x)), \
26  
-         color, 2*x+1); \
27  
-  memset(((Uint8*)super->pixels+ (y0-y)*super->pitch+ (x0-x)), \
28  
-         color, 2*x+1);
29  
-
30  
-
31  
-#elif SDL_DRAW_BPP == 2
32  
-#define SDL_DRAW_PUTPIXEL \
33  
-{                                                         \
34  
-  p0 = ((Uint8*)super->pixels+ (y0+y)*super->pitch+ (x0-x)*2); \
35  
-  p1 = ((Uint8*)super->pixels+ (y0-y)*super->pitch+ (x0-x)*2); \
36  
-  i = 2*x+1;                                              \
37  
-  switch( i % 4 ) {                                       \
38  
-    do{                                                   \
39  
-      case 0: *(Uint16*)p0 = color; *(Uint16*)p1 = color; \
40  
-              p0+=2; p1+=2;                               \
41  
-      case 3: *(Uint16*)p0 = color; *(Uint16*)p1 = color; \
42  
-              p0+=2; p1+=2;                               \
43  
-      case 2: *(Uint16*)p0 = color; *(Uint16*)p1 = color; \
44  
-              p0+=2; p1+=2;                               \
45  
-      case 1: *(Uint16*)p0 = color; *(Uint16*)p1 = color; \
46  
-              p0+=2; p1+=2;                               \
47  
-    }while( (i-=4) > 0 );                                 \
48  
-  }                                                       \
49  
-}
50  
-
51  
-
52  
-#elif SDL_DRAW_BPP == 3
53  
-#define SDL_DRAW_PUTPIXEL_BPP_3_AUX \
54  
-    if (SDL_BYTEORDER == SDL_BIG_ENDIAN) { \
55  
-      p0[0] = colorbyte2;                  \
56  
-      p0[1] = colorbyte1;                  \
57  
-      p0[2] = colorbyte0;                  \
58  
-      p1[0] = colorbyte2;                  \
59  
-      p1[1] = colorbyte1;                  \
60  
-      p1[2] = colorbyte0;                  \
61  
-    } else {                               \
62  
-      p0[0] = colorbyte0;                  \
63  
-      p0[1] = colorbyte1;                  \
64  
-      p0[2] = colorbyte2;                  \
65  
-      p1[0] = colorbyte0;                  \
66  
-      p1[1] = colorbyte1;                  \
67  
-      p1[2] = colorbyte2;                  \
68  
-    }
69  
-
70  
-#define SDL_DRAW_PUTPIXEL \
71  
-{                                         \
72  
-  p0 = ((Uint8*)super->pixels+ (y0+y)*super->pitch+ (x0-x)*3); \
73  
-  p1 = ((Uint8*)super->pixels+ (y0-y)*super->pitch+ (x0-x)*3); \
74  
-  i = 2*x+1;                              \
75  
-  switch( i % 4 ) {                       \
76  
-    do{                                   \
77  
-      case 0: SDL_DRAW_PUTPIXEL_BPP_3_AUX \
78  
-              p0+=3; p1+=3;               \
79  
-      case 3: SDL_DRAW_PUTPIXEL_BPP_3_AUX \
80  
-              p0+=3; p1+=3;               \
81  
-      case 2: SDL_DRAW_PUTPIXEL_BPP_3_AUX \
82  
-              p0+=3; p1+=3;               \
83  
-      case 1: SDL_DRAW_PUTPIXEL_BPP_3_AUX \
84  
-              p0+=3; p1+=3;               \
85  
-    }while( (i-=4) > 0 );                 \
86  
-  }                                       \
87  
-}
88  
-
89  
-
90  
-#elif SDL_DRAW_BPP == 4
91  
-
92  
-#ifdef __linux__
93  
-#define SDL_DRAW_WMEMSET_START \
94  
-if (sizeof(wchar_t) == sizeof(Uint32)) {                                     \
95  
-  wmemset( (wchar_t*)((Uint8*)super->pixels+ (y0+y)*super->pitch+ (x0-x)*4), \
96  
-         color, 2*x+1);                                                      \
97  
-  wmemset( (wchar_t*)((Uint8*)super->pixels+ (y0-y)*super->pitch+ (x0-x)*4), \
98  
-         color, 2*x+1);                                                      \
99  
-} else {
100  
-#define SDL_DRAW_WMEMSET_END }
101  
-#else
102  
-#define SDL_DRAW_WMEMSET_START
103  
-#define SDL_DRAW_WMEMSET_END
104  
-#endif
105  
-
106  
-#define SDL_DRAW_PUTPIXEL \
107  
-SDL_DRAW_WMEMSET_START                                    \
108  
-  p0 = ((Uint8*)super->pixels+ (y0+y)*super->pitch+ (x0-x)*4); \
109  
-  p1 = ((Uint8*)super->pixels+ (y0-y)*super->pitch+ (x0-x)*4); \
110  
-  i = 2*x+1;                                              \
111  
-  switch( i % 4 ) {                                       \
112  
-    do{                                                   \
113  
-      case 0: *(Uint32*)p0 = color; *(Uint32*)p1 = color; \
114  
-              p0+=4; p1+=4;                               \
115  
-      case 3: *(Uint32*)p0 = color; *(Uint32*)p1 = color; \
116  
-              p0+=4; p1+=4;                               \
117  
-      case 2: *(Uint32*)p0 = color; *(Uint32*)p1 = color; \
118  
-              p0+=4; p1+=4;                               \
119  
-      case 1: *(Uint32*)p0 = color; *(Uint32*)p1 = color; \
120  
-              p0+=4; p1+=4;                               \
121  
-    }while( (i-=4) > 0 );                                 \
122  
-  }                                                       \
123  
-SDL_DRAW_WMEMSET_END
124  
-
125  
-#endif /*SDL_DRAW_BPP*/
126  
-
127  
-
128  
-
129  
-void SDL_DRAWFUNCTION(SDL_Surface *super,
130  
-                      Sint16 x0, Sint16 y0,
131  
-                      Uint16 Xradius, Uint16 Yradius,
132  
-                      Uint32 color)
133  
-{
134  
-#if SDL_DRAW_BPP == 3
135  
-  Uint8 colorbyte0 = (Uint8) (color & 0xff);
136  
-  Uint8 colorbyte1 = (Uint8) ((color >> 8) & 0xff);
137  
-  Uint8 colorbyte2 = (Uint8) ((color >> 16) & 0xff);
138  
-#endif
139  
-
140  
-#if SDL_DRAW_BPP != 1
141  
-  register Uint8 *p0;
142  
-  register Uint8 *p1;
143  
-  register Sint16 i;
144  
-#endif
145  
-
146  
-  Sint32 x, y;
147  
-  Sint32 Xchange, Ychange;
148  
-  Sint32 EllipseError;
149  
-  Sint32 TwoASquare, TwoBSquare;
150  
-  Sint32 StoppingX, StoppingY;
151  
-
152  
-  TwoASquare = 2*Xradius*Xradius;
153  
-  TwoBSquare = 2*Yradius*Yradius;
154  
-
155  
-  /*1st set of points*/
156  
-  x = Xradius-1;  /*radius zero == draw nothing*/
157  
-  y = 0;
158  
-
159  
-  Xchange = Yradius*Yradius*(1-2*Xradius);
160  
-  Ychange = Xradius*Xradius;
161  
-
162  
-  EllipseError = 0;
163  
-
164  
-  StoppingX = TwoBSquare*Xradius;
165  
-  StoppingY = 0;
166  
-
167  
-  /* Lock surface */
168  
-  if (SDL_MUSTLOCK(super)) {
169  
-      if (SDL_LockSurface(super) < 0)  { return; }
170  
-  }
171  
-   
172  
-  /*Plot 2 ellipse scan lines for iteration*/
173  
-  while (StoppingX > StoppingY) {
174  
-
175  
-    SDL_DRAW_PUTPIXEL
176  
-
177  
-    ++y;
178  
-    StoppingY    += TwoASquare;
179  
-    EllipseError += Ychange;
180  
-    Ychange      += TwoASquare;
181  
-    if (( 2*EllipseError + Xchange) > 0) {
182  
-      --x;
183  
-      StoppingX    -= TwoBSquare;
184  
-      EllipseError += Xchange;
185  
-      Xchange      += TwoBSquare;
186  
-    }
187  
-  }/*while*/
188  
-
189  
-  /*2nd set of points*/
190  
-  x = 0;
191  
-  y = Yradius-1;  /*radius zero == draw nothing*/
192  
-  Xchange = Yradius*Yradius;
193  
-  Ychange = Xradius*Xradius*(1-2*Yradius);
194  
-  EllipseError = 0;
195  
-  StoppingX = 0;
196  
-  StoppingY = TwoASquare*Yradius;
197  
-
198  
-  /*Plot 2 ellipse scan lines for iteration*/
199  
-  while (StoppingX < StoppingY) {
200  
-
201  
-    SDL_DRAW_PUTPIXEL
202  
-
203  
-    ++x;
204  
-    StoppingX    += TwoBSquare;
205  
-    EllipseError += Xchange;
206  
-    Xchange      += TwoBSquare;
207  
-    if ((2*EllipseError + Ychange) > 0) {
208  
-      --y;
209  
-      StoppingY    -= TwoASquare;
210  
-      EllipseError += Ychange;
211  
-      Ychange      += TwoASquare;
212  
-    }
213  
-  }
214  
-
215  
-  /* Unlock surface */
216  
-  if (SDL_MUSTLOCK(super))  { SDL_UnlockSurface(super); }  
217  
-  
218  
-}/*Draw_FillEllipse*/
219  
-
220  
-
221  
-#undef SDL_DRAW_PUTPIXEL
222  
-#undef SDL_DRAW_PUTPIXEL_BPP_3_AUX
223  
-
224  
-#undef SDL_DRAW_WMEMSET_START
225  
-#undef SDL_DRAW_WMEMSET_END
226  
-
256  firmware/sim/sdl_draw/Draw_FillRound.c
... ...
@@ -1,256 +0,0 @@
1  
-/*!
2  
-  \file Draw_FillRound.c
3  
-  \author Mario Palomo <mpalomo@ihman.com>
4  
-  \author Jose M. de la Huerga Fernández
5  
-  \author Pepe González Mora
6  
-  \date 05-2002
7  
-
8  
-  This library is free software; you can redistribute it and/or
9  
-  modify it under the terms of the GNU Library General Public
10  
-  License as published by the Free Software Foundation; either
11  
-  version 2 of the License, or (at your option) any later version.
12  
-
13  
-  This library is distributed in the hope that it will be useful,
14  
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  
-  Library General Public License for more details.
17  
-
18  
-  You should have received a copy of the GNU Library General Public
19  
-  License along with this library; if not, write to the Free Foundation,
20  
-  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  
-*/
22  
-
23  
-#if SDL_DRAW_BPP == 1
24  
-#define SDL_DRAW_PUTPIXEL \
25  
-  memset(p0, color, X2center - Xcenter + 2*corner+1);                      \
26  
-  memset(p1, color, X2center - Xcenter + 2*corner+1);                      \
27  
-  p0 = ((Uint8*)super->pixels+(Y2center+corner)*super->pitch+(Xcenter-x)); \
28  
-  p1 = ((Uint8*)super->pixels+(Ycenter-corner)*super->pitch +(Xcenter-x)); \
29  
-  memset(p0, color, X2center - Xcenter + 2*x+1);                           \
30  
-  memset(p1, color, X2center - Xcenter + 2*x+1);
31  
-
32  
-#elif SDL_DRAW_BPP == 2
33  
-#define SDL_DRAW_PUTPIXEL \
34  
-  i = X2center - Xcenter + 2*corner+1;                    \
35  
-  switch( i % 4 ) {                                       \
36  
-    do{                                                   \
37  
-      case 0: *(Uint16*)p0 = color; *(Uint16*)p1 = color; \
38  
-              p0+=2; p1+=2;                               \
39  
-      case 3: *(Uint16*)p0 = color; *(Uint16*)p1 = color; \
40  
-              p0+=2; p1+=2;                               \
41  
-      case 2: *(Uint16*)p0 = color; *(Uint16*)p1 = color; \
42  
-              p0+=2; p1+=2;                               \
43  
-      case 1: *(Uint16*)p0 = color; *(Uint16*)p1 = color; \
44  
-              p0+=2; p1+=2;                               \
45  
-    }while( (i-=4) > 0 );                                 \
46  
-  }                                                       \
47  
-  p0 = ((Uint8*)super->pixels+(Y2center+corner)*super->pitch+(Xcenter-x)*2); \
48  
-  p1 = ((Uint8*)super->pixels+(Ycenter-corner)*super->pitch +(Xcenter-x)*2); \
49  
-  i = X2center - Xcenter + 2*x+1;                         \
50  
-  switch( i % 4 ) {                                       \
51  
-    do{                                                   \
52  
-      case 0: *(Uint16*)p0 = color; *(Uint16*)p1 = color; \
53  
-              p0+=2; p1+=2;                               \
54  
-      case 3: *(Uint16*)p0 = color; *(Uint16*)p1 = color; \
55  
-              p0+=2; p1+=2;                               \
56  
-      case 2: *(Uint16*)p0 = color; *(Uint16*)p1 = color; \
57  
-              p0+=2; p1+=2;                               \
58  
-      case 1: *(Uint16*)p0 = color; *(Uint16*)p1 = color; \
59  
-              p0+=2; p1+=2;                               \
60  
-    }while( (i-=4) > 0 );                                 \
61  
-  }
62  
-
63  
-#elif SDL_DRAW_BPP == 3
64  
-#define SDL_DRAW_PUTPIXEL_BPP_3_AUX \
65  
-    if (SDL_BYTEORDER == SDL_BIG_ENDIAN) { \
66  
-      p0[0] = colorbyte2;                   \
67  
-      p0[1] = colorbyte1;                   \
68  
-      p0[2] = colorbyte0;                   \
69  
-      p1[0] = colorbyte2;                   \
70  
-      p1[1] = colorbyte1;                   \
71  
-      p1[2] = colorbyte0;                   \
72  
-    } else {                                \
73  
-      p0[0] = colorbyte0;                   \
74  
-      p0[1] = colorbyte1;                   \
75  
-      p0[2] = colorbyte2;                   \
76  
-      p1[0] = colorbyte0;                   \
77  
-      p1[1] = colorbyte1;                   \
78  
-      p1[2] = colorbyte2;                   \
79  
-    }
80  
-
81  
-#define SDL_DRAW_PUTPIXEL \
82  
-  i = X2center - Xcenter + 2*corner+1;    \
83  
-  switch( i % 4 ) {                       \
84  
-    do{                                   \
85  
-      case 0: SDL_DRAW_PUTPIXEL_BPP_3_AUX \
86  
-              p0+=3; p1+=3;               \
87  
-      case 3: SDL_DRAW_PUTPIXEL_BPP_3_AUX \
88  
-              p0+=3; p1+=3;               \
89  
-      case 2: SDL_DRAW_PUTPIXEL_BPP_3_AUX \
90  
-              p0+=3; p1+=3;               \
91  
-      case 1: SDL_DRAW_PUTPIXEL_BPP_3_AUX \
92  
-              p0+=3; p1+=3;               \
93  
-    }while( (i-=4) > 0 );                 \
94  
-  }                                       \
95  
-  p0 = ((Uint8*)super->pixels+(Y2center+corner)*super->pitch+(Xcenter-x)*3); \
96  
-  p1 = ((Uint8*)super->pixels+(Ycenter-corner)*super->pitch +(Xcenter-x)*3); \
97  
-  i = X2center - Xcenter + 2*x+1;         \
98  
-  switch( i % 4 ) {                       \
99  
-    do{                                   \
100  
-      case 0: SDL_DRAW_PUTPIXEL_BPP_3_AUX \
101  
-              p0+=3; p1+=3;               \
102  
-      case 3: SDL_DRAW_PUTPIXEL_BPP_3_AUX \
103  
-              p0+=3; p1+=3;               \
104  
-      case 2: SDL_DRAW_PUTPIXEL_BPP_3_AUX \
105  
-              p0+=3; p1+=3;               \
106  
-      case 1: SDL_DRAW_PUTPIXEL_BPP_3_AUX \
107  
-              p0+=3; p1+=3;               \
108  
-    }while( (i-=4) > 0 );                 \
109  
-  }
110  
-
111  
-
112  
-#elif SDL_DRAW_BPP == 4
113  
-
114  
-#ifdef __linux__
115  
-#define SDL_DRAW_WMEMSET_START \
116  
-if (sizeof(wchar_t) == sizeof(Uint32)) { \
117  
-  wmemset((wchar_t*)p0, color, X2center - Xcenter + 2*corner+1); \
118  
-  wmemset((wchar_t*)p1, color, X2center - Xcenter + 2*corner+1); \
119  
-  p0 = ((Uint8*)super->pixels+(Y2center+corner)*super->pitch+(Xcenter-x)*4); \
120  
-  p1 = ((Uint8*)super->pixels+(Ycenter-corner)*super->pitch +(Xcenter-x)*4); \
121  
-  wmemset((wchar_t*)p0, color, X2center - Xcenter + 2*x+1); \
122  
-  wmemset((wchar_t*)p1, color, X2center - Xcenter + 2*x+1); \
123  
-} else {
124  
-#define SDL_DRAW_WMEMSET_END }
125  
-#else
126  
-#define SDL_DRAW_WMEMSET_START
127  
-#define SDL_DRAW_WMEMSET_END
128  
-#endif
129  
-
130  
-#define SDL_DRAW_PUTPIXEL \
131  
-SDL_DRAW_WMEMSET_START                                    \
132  
-  i = X2center - Xcenter + 2*corner+1;                    \
133  
-  switch( i % 4 ) {                                       \
134  
-    do{                                                   \
135  
-      case 0: *(Uint32*)p0 = color; *(Uint32*)p1 = color; \
136  
-              p0+=4; p1+=4;                               \
137  
-      case 3: *(Uint32*)p0 = color; *(Uint32*)p1 = color; \
138  
-              p0+=4; p1+=4;                               \
139  
-      case 2: *(Uint32*)p0 = color; *(Uint32*)p1 = color; \
140  
-              p0+=4; p1+=4;                               \
141  
-      case 1: *(Uint32*)p0 = color; *(Uint32*)p1 = color; \
142  
-              p0+=4; p1+=4;                               \
143  
-    }while( (i-=4) > 0 );                                 \
144  
-  }                                                       \
145  
-  p0 = ((Uint8*)super->pixels+(Y2center+corner)*super->pitch+(Xcenter-x)*4); \
146  
-  p1 = ((Uint8*)super->pixels+(Ycenter-corner)*super->pitch +(Xcenter-x)*4); \
147  
-  i = X2center - Xcenter + 2*x+1;                         \
148  
-  switch( i % 4 ) {                                       \
149  
-    do{                                                   \
150  
-      case 0: *(Uint32*)p0 = color; *(Uint32*)p1 = color; \
151  
-              p0+=4; p1+=4;                               \
152  
-      case 3: *(Uint32*)p0 = color; *(Uint32*)p1 = color; \
153  
-              p0+=4; p1+=4;                               \
154  
-      case 2: *(Uint32*)p0 = color; *(Uint32*)p1 = color; \
155  
-              p0+=4; p1+=4;                               \
156  
-      case 1: *(Uint32*)p0 = color; *(Uint32*)p1 = color; \
157  
-              p0+=4; p1+=4;                               \
158  
-    }while( (i-=4) > 0 );                                 \
159  
-  }                                                       \
160  
-SDL_DRAW_WMEMSET_END
161  
-
162  
-#endif /*SDL_DRAW_BPP*/
163  
-
164  
-
165  
-void SDL_DRAWFUNCTION(SDL_Surface *super,
166  
-                      Sint16 x0,Sint16 y0, Uint16 w,Uint16 h,
167  
-                      Uint16 corner, Uint32 color)
168  
-{
169  
-#if SDL_DRAW_BPP == 3
170  
-  Uint8 colorbyte0 = (Uint8) (color & 0xff);
171  
-  Uint8 colorbyte1 = (Uint8) ((color >> 8)  & 0xff);
172  
-  Uint8 colorbyte2 = (Uint8) ((color >> 16) & 0xff);
173  
-#endif
174  
-
175  
-  register Uint8 *p0;
176  
-  register Uint8 *p1;
177  
-#if SDL_DRAW_BPP != 1
178  
-  register Sint16 i;
179  
-#endif
180  
-  Sint16 dx, dy;
181  
-
182  
-  Sint16 Xcenter, Ycenter, X2center, Y2center;
183  
-
184  
-  Sint16 x = 0;
185  
-  Sint16 rightInc = 6;
186  
-  Sint16 d, diagonalInc;
187  
-
188  
-  SDL_Rect r;
189  
-
190  
-
191  
-  if (w==0 || h==0)  return;
192  
-
193  
-  /*TODO: We can do better :-)*/
194  
-  if (corner!=0) {
195  
-    d = w<h ? w : h;
196  
-    --corner;
197  
-    if (corner!=0 && corner+2 >= d ) {
198  
-      if (corner+2 == d)  --corner;
199  
-      else corner = 0;
200  
-    }
201  
-  }
202  
-
203  
-  d = 3 - (corner<<1);
204  
-  diagonalInc = 10 - (corner<<2);
205  
-
206  
-  /*Rectangles*/
207  
-  dx = w - (corner<<1);
208  
-  Xcenter = x0+corner;
209  
-  dy = h - (corner<<1);
210  
-  Ycenter = y0+corner;
211  
-
212  
-  /*Centers*/
213  
-  X2center=Xcenter+dx-1;
214  
-  Y2center=Ycenter+dy-1;
215  
-
216  
-  r.x = x0; r.y = Ycenter;
217  
-  r.w = w; r.h = dy;
218  
-  SDL_FillRect(super, &r, color);
219  
-
220  
-  /* Lock surface */
221  
-  if (SDL_MUSTLOCK(super)) {
222  
-      if (SDL_LockSurface(super) < 0)  { return; }
223  
-  }
224  
-  
225  
-  while (x < corner) {
226  
-
227  
-    p0 = ((Uint8*)super->pixels+(Ycenter-x)*super->pitch +
228  
-                                       (Xcenter-corner)*SDL_DRAW_BPP);
229  
-    p1 = ((Uint8*)super->pixels+(Y2center+x)*super->pitch +
230  
-                                        (Xcenter-corner)*SDL_DRAW_BPP);
231  
-
232  
-    SDL_DRAW_PUTPIXEL
233  
-
234  
-    if (d >= 0) {
235  
-      d += diagonalInc;
236  
-      diagonalInc += 8;
237  
-      --corner;
238  
-    } else {
239  
-      d += rightInc;
240  
-      diagonalInc += 4;
241  
-    }
242  
-    rightInc += 4;
243  
-    ++x;
244  
-  }/*while*/
245  
-
246  
-  /* Unlock surface */
247  
-  if (SDL_MUSTLOCK(super))  { SDL_UnlockSurface(super); }
248  
-  
249  
-}/*Draw_FillRound*/
250  
-
251  
-
252  
-#undef SDL_DRAW_PUTPIXEL
253  
-
254  
-#undef SDL_DRAW_WMEMSET_START
255  
-#undef SDL_DRAW_WMEMSET_END
256  
-
125  firmware/sim/sdl_draw/Draw_HLine.c
... ...
@@ -1,125 +0,0 @@
1  
-/*!
2  
-  \file Draw_HLine.c
3  
-  \author Mario Palomo <mpalomo@ihman.com>
4  
-  \author Jose M. de la Huerga Fernández
5  
-  \author Pepe González Mora
6  
-  \date 05-2002
7  
-
8  
-  This library is free software; you can redistribute it and/or
9  
-  modify it under the terms of the GNU Library General Public
10  
-  License as published by the Free Software Foundation; either
11  
-  version 2 of the License, or (at your option) any later version.
12  
-
13  
-  This library is distributed in the hope that it will be useful,
14  
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  
-  Library General Public License for more details.
17  
-
18  
-  You should have received a copy of the GNU Library General Public
19  
-  License along with this library; if not, write to the Free Foundation,
20  
-  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  
-*/
22  
-
23  
-#if SDL_DRAW_BPP == 1
24  
-#define SDL_DRAW_PUTPIXEL \
25  
-  memset(p, color, x1-x0+1);
26  
-
27  
-#elif SDL_DRAW_BPP == 2
28  
-#define SDL_DRAW_PUTPIXEL \
29  
-  i = x1-x0+1;                           \
30  
-  switch( i % 4 ) {                      \
31  
-    do{                                  \
32  
-      case 0: *(Uint16*)p = color; p+=2; \
33  
-      case 3: *(Uint16*)p = color; p+=2; \
34  
-      case 2: *(Uint16*)p = color; p+=2; \
35  
-      case 1: *(Uint16*)p = color; p+=2; \
36  
-    }while( (i-=4) > 0 );                \
37  
-  }
38  
-
39  
-#elif SDL_DRAW_BPP == 3
40  
-#define SDL_DRAW_PUTPIXEL_BPP_3_AUX \
41  
-    if (SDL_BYTEORDER == SDL_BIG_ENDIAN) { \
42  
-      p[0] = colorbyte2;                   \
43  
-      p[1] = colorbyte1;                   \
44  
-      p[2] = colorbyte0;                   \
45  
-    } else {                               \
46  
-      p[0] = colorbyte0;                   \
47  
-      p[1] = colorbyte1;                   \
48  
-      p[2] = colorbyte2;                   \
49  
-    }
50  
-
51  
-#define SDL_DRAW_PUTPIXEL \
52  
-  i = x1-x0+1;                                   \
53  
-  switch( i % 4 ) {                              \
54  
-    do{                                          \
55  
-      case 0: SDL_DRAW_PUTPIXEL_BPP_3_AUX  p+=3; \
56  
-      case 3: SDL_DRAW_PUTPIXEL_BPP_3_AUX  p+=3; \
57  
-      case 2: SDL_DRAW_PUTPIXEL_BPP_3_AUX  p+=3; \
58  
-      case 1: SDL_DRAW_PUTPIXEL_BPP_3_AUX  p+=3; \
59  
-    }while( (i-=4) > 0 );                        \
60  
-  }
61  
-
62  
-#elif SDL_DRAW_BPP == 4
63  
-
64  
-#ifdef __linux__
65  
-#define SDL_DRAW_WMEMSET_START \
66  
-if (sizeof(wchar_t) == sizeof(Uint32)) { \
67  
-  wmemset((wchar_t*)p, color, x1-x0+1);  \
68  
-} else {
69  
-#define SDL_DRAW_WMEMSET_END }
70  
-#else
71  
-#define SDL_DRAW_WMEMSET_START
72  
-#define SDL_DRAW_WMEMSET_END
73  
-#endif
74  
-
75  
-#define SDL_DRAW_PUTPIXEL \
76  
-SDL_DRAW_WMEMSET_START                   \
77  
-  i = x1-x0+1;                           \
78  
-  switch( i % 4 ) {                      \
79  
-    do{                                  \
80  
-      case 0: *(Uint32*)p = color; p+=4; \
81  
-      case 3: *(Uint32*)p = color; p+=4; \
82  
-      case 2: *(Uint32*)p = color; p+=4; \
83  
-      case 1: *(Uint32*)p = color; p+=4; \
84  
-    }while( (i-=4) > 0 );                \
85  
-  }                                      \
86  
-SDL_DRAW_WMEMSET_END
87  
-
88  
-#endif /*SDL_DRAW_BPP*/
89  
-
90  
-
91  
-void SDL_DRAWFUNCTION(SDL_Surface *super,
92  
-                      Sint16 x0,Sint16 y0, Sint16 x1,
93  
-                      Uint32 color)
94  
-{
95  
-#if SDL_DRAW_BPP == 3
96  
-  Uint8 colorbyte0 = (Uint8) (color & 0xff);
97  
-  Uint8 colorbyte1 = (Uint8) ((color >> 8) & 0xff);
98  
-  Uint8 colorbyte2 = (Uint8) ((color >> 16) & 0xff);
99  
-#endif
100  
-
101  
-  register Uint8 *p;
102  
-  register Sint16 i;
103  
-
104  
-  if (x0 > x1)  { i=x1; x1=x0; x0=i; }
105  
-  p = (Uint8*)super->pixels + y0 * super->pitch + x0 * SDL_DRAW_BPP;
106  
-
107  
-  /* Lock surface */
108  
-  if (SDL_MUSTLOCK(super)) {
109  
-      if (SDL_LockSurface(super) < 0)  { return; }
110  
-  }
111  
-  
112  
-  SDL_DRAW_PUTPIXEL
113  
-
114  
-  /* Unlock surface */
115  
-  if (SDL_MUSTLOCK(super))  { SDL_UnlockSurface(super); }
116  
-  
117  
-}/*Draw_HLine*/
118  
-
119  
-
120  
-#undef SDL_DRAW_PUTPIXEL
121  
-#undef SDL_DRAW_PUTPIXEL_BPP_3_AUX
122  
-
123  
-#undef SDL_DRAW_WMEMSET_START
124  
-#undef SDL_DRAW_WMEMSET_END
125  
-
167  firmware/sim/sdl_draw/Draw_Line.c
... ...
@@ -1,167 +0,0 @@
1  
-/*!
2  
-  \file Draw_Line.c
3  
-  \author Mario Palomo <mpalomo@ihman.com>
4  
-  \author Jose M. de la Huerga Fernández
5  
-  \author Pepe González Mora
6  
-  \date 05-2002
7  
-
8  
-  Based in Kenny Hoff sourcer.
9  
-*/
10  
-/* 
11  
-  This library is free software; you can redistribute it and/or
12  
-  modify it under the terms of the GNU Library General Public
13  
-  License as published by the Free Software Foundation; either
14  
-  version 2 of the License, or (at your option) any later version.
15  
-
16  
-  This library is distributed in the hope that it will be useful,
17  
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  
-  Library General Public License for more details.
20  
-
21  
-  You should have received a copy of the GNU Library General Public
22  
-  License along with this library; if not, write to the Free Foundation,
23  
-  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24  
-*/
25  
-
26  
-#define SDL_DRAW_PUTPIXEL_BPP(A, B, C, D) *(A(B(Uint8*)D))=C;
27  
-  
28  
-#if SDL_DRAW_BPP == 1
29  
-#define SDL_DRAW_PUTPIXEL(D) SDL_DRAW_PUTPIXEL_BPP(0+,0+,color,D)
30  
-
31  
-#elif SDL_DRAW_BPP == 2
32  
-#define SDL_DRAW_PUTPIXEL(D) SDL_DRAW_PUTPIXEL_BPP((Uint16*),0+,color,D)
33  
-
34  
-#elif SDL_DRAW_BPP == 3
35  
-#define SDL_DRAW_PUTPIXEL(D) \
36  
-  SDL_DRAW_PUTPIXEL_BPP(0+,1+,(Uint8)colorbyte1,D)   \
37  
-  if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {         \
38  
-    SDL_DRAW_PUTPIXEL_BPP(0+,0+,(Uint8)colorbyte2,D)   \
39  
-    SDL_DRAW_PUTPIXEL_BPP(0+,2+,(Uint8)colorbyte0,D) \
40  
-  }else{                                         \
41  
-    SDL_DRAW_PUTPIXEL_BPP(0+,0+,(Uint8)colorbyte0,D)   \
42  
-    SDL_DRAW_PUTPIXEL_BPP(0+,2+,(Uint8)colorbyte2,D) \
43  
-  }
44  
-
45  
-#elif SDL_DRAW_BPP == 4
46  
-#define SDL_DRAW_PUTPIXEL(D) SDL_DRAW_PUTPIXEL_BPP((Uint32*),0+,color,D)
47  
-
48  
-#endif /*SDL_DRAW_BPP*/
49  
-
50  
-
51  
-void SDL_DRAWFUNCTION(SDL_Surface *super,
52  
-                      Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2,
53  
-                      Uint32 color)
54  
-{
55  
-#if SDL_DRAW_BPP == 3
56  
-  Uint8 colorbyte0 = (Uint8) (color & 0xff);
57  
-  Uint8 colorbyte1 = (Uint8) ((color >> 8) & 0xff);
58  
-  Uint8 colorbyte2 = (Uint8) ((color >> 16) & 0xff);
59  
-#endif
60  
-  
61  
-  register Sint16 dx;
62  
-  register Sint16 dy;
63  
-  
64  
-  Sint16 fbXincr, fbYincr, fbXYincr;
65  
-  Sint16 dPr, dPru, P;
66  
-
67  
-  Sint16 pixx = super->format->BytesPerPixel;
68  
-  Sint16 pixy = super->pitch;
69  
-
70  
-  Uint8 *AfbAddr, *BfbAddr;
71  
-
72  
-  /* Clip line and test if we have to draw only if we need to do it */
73  
-/* It is in next version.
74  
-#ifdef SDL_DRAW_CLIP
75  
-  if (!(clipLine(super, &x1, &y1, &x2, &y2))) { return; }
76  
-#endif
77  
-*/
78  
-  /* Store the fremebuffer Endpoint-Addresses (A and B) */ 
79  
-  AfbAddr = ((Uint8*)super->pixels) + pixx * (int)x1 + pixy * (int)y1;
80  
-  BfbAddr = ((Uint8*)super->pixels) + pixx * (int)x2 + pixy * (int)y2;
81  
-
82  
-  
83  
-    
84  
-  /* Lock surface */
85  
-  if (SDL_MUSTLOCK(super)) {
86  
-      if (SDL_LockSurface(super) < 0)  { return; }
87  
-  }
88  
-  
89  
-  fbXincr=pixx;
90  
-  if ( (dx=x2-x1) >= 0 ) goto AFTERNEGX;
91  
-    dx = -dx;
92  
-    fbXincr = -pixx;
93  
-  AFTERNEGX:
94  
-
95  
-  fbYincr=pixy; //debug
96  
-  if ( (dy=y2-y1) >= 0) goto AFTERNEGY;
97  
-    fbYincr = -pixy;
98  
-    dy = -dy;
99  
-  AFTERNEGY:
100  
-
101  
-  fbXYincr = fbXincr+fbYincr;
102  
-
103  
-  if (dy > dx) goto YisIndependent;	/*Check if X or Y is independent vaiable */
104  
-
105  
-  /*XisIndependent;*/
106  
-    dPr = dy+dy;
107  
-    P = -dx;
108  
-    dPru = P+P;
109  
-    dy = dx>>1;
110  
-    XLOOP:
111  
-      SDL_DRAW_PUTPIXEL(AfbAddr);	/*Plot the pixel from end of pointer one*/
112  
-      SDL_DRAW_PUTPIXEL(BfbAddr);	/*Plot the pixel from end of pointer two*/
113  
-      if ((P+=dPr) > 0) goto RightAndUp;
114  
-      /*Up:*/
115  
-        AfbAddr+=fbXincr;
116  
-	BfbAddr-=fbXincr;
117  
-        if ((dy=dy-1) > 0) goto XLOOP;
118  
-        SDL_DRAW_PUTPIXEL(AfbAddr)  	/*(Fix midpoint problem) Plot last PT from end pointer one*/
119  
-        if (( dx & 1) == 0) goto END_P;
120  
-        SDL_DRAW_PUTPIXEL(BfbAddr);	/*Plot last PT from end of pointer two if independent is odd*/
121  
-        goto END_P;
122  
-      RightAndUp:
123  
-	AfbAddr+=fbXYincr;		 /*Advance to next point from end of pointer one*/
124  
-	BfbAddr-=fbXYincr;		 /*Advance to next point from end of pointer two*/
125  
-	P+=dPru;
126  
-	if ((dy=dy-1) > 0) goto XLOOP;
127  
-	SDL_DRAW_PUTPIXEL(AfbAddr);	 /*(Fix midpoint problem) Plot last PT from end of pointer one*/
128  
-	if ((dx & 1) == 0) goto END_P;
129  
-	SDL_DRAW_PUTPIXEL(BfbAddr);	 /*Plot last PT from end of pointer two if indepent is odd*/
130  
-	goto END_P;
131  
-	
132  
-    YisIndependent:
133  
-	dPr = dx+dx;
134  
-	P = -dy;
135  
-	dPru = P+P;
136  
-	dx = dy >>1;
137  
-     YLOOP:                                 /* PROCESS EACH POINT IN THE LINE ONE AT A TIME (use dX as loop counter) */
138  
-        SDL_DRAW_PUTPIXEL(AfbAddr);         /* PLOT THE PIXEL FROM END A */
139  
-        SDL_DRAW_PUTPIXEL(BfbAddr);         /* PLOT THE PIXEL FROM END B */
140  
-        if ((P+=dPr) > 0) goto RightAndUp2; /* INCREMENT DECISION, CHECK IF THE PIXEL IS GOING RIGHT AND UP */
141  
-        /*Up:*/
142  
-            AfbAddr+=fbYincr;               /* ADVANCE TO NEXT POINT FROM END A */
143  
-            BfbAddr-=fbYincr;               /* ADVANCE TO NEXT POINT FROM END B */
144  
-            if ((dx=dx-1) > 0) goto YLOOP;  /* DECREMENT LOOP VARIABLE AND LOOP */
145  
-            SDL_DRAW_PUTPIXEL(AfbAddr);     /* (FIX MIDPOINT PROBLEM) PLOT THE LAST POINT FROM END A */
146  
-            if ((dy & 1) == 0) goto END_P;      /* FINISHED IF INDEPENDENT IS EVEN (ODD # STEPS) */
147  
-            SDL_DRAW_PUTPIXEL(BfbAddr);     /* PLOT LAST PT FROM END B IF INDEPENDENT IS ODD (EVEN # STEPS) */
148  
-            goto END_P;
149  
-        RightAndUp2:
150  
-             AfbAddr+=fbXYincr;             /* ADVANCE TO NEXT POINT FROM END A */
151  
-             BfbAddr-=fbXYincr;             /* ADVANCE TO NEXT POINT FROM END B */
152  
-            P+=dPru;                        /* INCREMENT DECISION (for up) */
153  
-            if ((dx=dx-1) > 0) goto YLOOP;  /* DECREMENT LOOP VARIABLE AND LOOP */
154  
-            SDL_DRAW_PUTPIXEL(AfbAddr);     /* (FIX MIDPOINT PROBLEM) PLOT THE LAST POINT FROM END A */
155  
-            if ((dy & 1) == 0) goto END_P;      /* FINISHED IF INDEPENDENT IS EVEN (ODD # STEPS) */
156  
-            SDL_DRAW_PUTPIXEL(BfbAddr);     /* PLOT LAST PT FROM END B IF INDEPENDENT IS ODD (EVEN # STEPS) */
157  
-     
158  
-END_P: 
159  
-  /* Unlock surface */
160  
-  if (SDL_MUSTLOCK(super))  { SDL_UnlockSurface(super); }
161  
-  
162  
-}/*Draw_Line*/
163  
-
164  
-
165  
-#undef SDL_DRAW_PUTPIXEL
166  
-#undef SDL_DRAW_PUTPIXEL_BPP
167  
-
72  firmware/sim/sdl_draw/Draw_Pixel.c
... ...
@@ -1,72 +0,0 @@
1  
-/*!
2  
-  \file Draw_Pixel.c
3  
-  \author Mario Palomo <mpalomo@ihman.com>
4  
-  \author Jose M. de la Huerga Fernández
5  
-  \author Pepe González Mora
6  
-  \date 05-2002
7  
-
8  
-  This library is free software; you can redistribute it and/or
9  
-  modify it under the terms of the GNU Library General Public
10  
-  License as published by the Free Software Foundation; either
11  
-  version 2 of the License, or (at your option) any later version.
12  
-
13  
-  This library is distributed in the hope that it will be useful,
14  
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  
-  Library General Public License for more details.
17  
-
18  
-  You should have received a copy of the GNU Library General Public
19  
-  License along with this library; if not, write to the Free Foundation,
20  
-  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  
-*/
22  
-#define SDL_DRAW_PUTPIXEL_BPP(A, B, C)  \
23  
-*(A(B(Uint8*)super->pixels + y*super->pitch + x*SDL_DRAW_BPP))=C;
24  
-
25  
-#if SDL_DRAW_BPP == 1
26  
-#define SDL_DRAW_PUTPIXEL SDL_DRAW_PUTPIXEL_BPP(0+,0+,(Uint8)color)
27  
-
28  
-#elif SDL_DRAW_BPP == 2
29  
-#define SDL_DRAW_PUTPIXEL SDL_DRAW_PUTPIXEL_BPP((Uint16*),0+,(Uint16)color)
30  
-
31  
-#elif SDL_DRAW_BPP == 3
32  
-#define SDL_DRAW_PUTPIXEL \
33  
-  SDL_DRAW_PUTPIXEL_BPP(0+,1+,colorbyte1)   \
34  
-  if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {         \
35  
-    SDL_DRAW_PUTPIXEL_BPP(0+,0+,colorbyte2)   \
36  
-    SDL_DRAW_PUTPIXEL_BPP(0+,2+,colorbyte0) \
37  
-  }else{                                         \
38  
-    SDL_DRAW_PUTPIXEL_BPP(0+,0+,colorbyte0)   \
39  
-    SDL_DRAW_PUTPIXEL_BPP(0+,2+,colorbyte2) \
40  
-  }
41  
-
42  
-#elif SDL_DRAW_BPP == 4
43  
-#define SDL_DRAW_PUTPIXEL SDL_DRAW_PUTPIXEL_BPP((Uint32*),0+,color)
44  
-
45  
-#endif /*SDL_DRAW_BPP*/
46  
-
47  
-
48  
-void SDL_DRAWFUNCTION(SDL_Surface *super,
49  
-                      Sint16 x, Sint16 y, Uint32 color)
50  
-{
51  
-#if SDL_DRAW_BPP == 3
52  
-  Uint8 colorbyte0 = (Uint8) (color & 0xff);
53  
-  Uint8 colorbyte1 = (Uint8) ((color >> 8) & 0xff);
54  
-  Uint8 colorbyte2 = (Uint8) ((color >> 16) & 0xff);
55  
-#endif
56  
-
57  
-  /* Lock surface */
58  
-  if (SDL_MUSTLOCK(super)) {
59  
-      if (SDL_LockSurface(super) < 0)  { return; }
60  
-  }
61  
-  
62  
-  SDL_DRAW_PUTPIXEL
63  
-
64  
-  /* Unlock surface */
65  
-  if (SDL_MUSTLOCK(super))  { SDL_UnlockSurface(super); }
66  
-  
67  
-}/*Draw_Pixel*/
68  
-
69  
-
70  
-#undef SDL_DRAW_PUTPIXEL
71  
-#undef SDL_DRAW_PUTPIXEL_BPP
72  
-
244  firmware/sim/sdl_draw/Draw_Rect.c
... ...
@@ -1,244 +0,0 @@
1  
-/*!
2  
-  \file Draw_Rect.c
3  
-  \author Mario Palomo <mpalomo@ihman.com>
4  
-  \author Jose M. de la Huerga Fernández
5  
-  \author Pepe González Mora
6  
-  \date 05-2002
7  
-
8  
-  This library is free software; you can redistribute it and/or
9  
-  modify it under the terms of the GNU Library General Public
10  
-  License as published by the Free Software Foundation; either
11  
-  version 2 of the License, or (at your option) any later version.
12  
-
13  
-  This library is distributed in the hope that it will be useful,
14