Subversion Repositories shark

Rev

Rev 529 | Rev 578 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
485 giacomo 1
#include <ll/i386/hw-data.h>
2
#include <ll/i386/mem.h>
3
#include <linux/fb.h>
4
 
5
static unsigned char font_table[127][8] =
6
      {
7
        {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
8
        {0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e},
9
        {0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7, 0xff, 0x7e},
10
        {0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00},
11
        {0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00},
12
        {0x38, 0x7c, 0x38, 0xfe, 0xfe, 0x7c, 0x38, 0x7c},
13
        {0x10, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x7c},
14
        {0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00},
15
        {0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff},
16
        {0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00},
17
        {0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff},
18
        {0x0f, 0x07, 0x0f, 0x7d, 0xcc, 0xcc, 0xcc, 0x78},
19
        {0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18},
20
        {0x3f, 0x33, 0x3f, 0x30, 0x30, 0x70, 0xf0, 0xe0},
21
        {0x7f, 0x63, 0x7f, 0x63, 0x63, 0x67, 0xe6, 0xc0},
22
        {0x99, 0x5a, 0x3c, 0xe7, 0xe7, 0x3c, 0x5a, 0x99},
23
        {0x80, 0xe0, 0xf8, 0xfe, 0xf8, 0xe0, 0x80, 0x00},
24
        {0x02, 0x0e, 0x3e, 0xfe, 0x3e, 0x0e, 0x02, 0x00},
25
        {0x18, 0x3c, 0x7e, 0x18, 0x18, 0x7e, 0x3c, 0x18},
26
        {0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00},
27
        {0x7f, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x00},
28
        {0x3e, 0x63, 0x38, 0x6c, 0x6c, 0x38, 0xcc, 0x78},
29
        {0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x00},
30
        {0x18, 0x3c, 0x7e, 0x18, 0x7e, 0x3c, 0x18, 0xff},
31
        {0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00},
32
        {0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00},
33
        {0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00},
34
        {0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00},
35
        {0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00},
36
        {0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00},
37
        {0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00},
38
        {0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00, 0x00},
39
        {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
40
        {0x30, 0x78, 0x78, 0x30, 0x30, 0x00, 0x30, 0x00},
41
        {0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00},
42
        {0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00},
43
        {0x30, 0x7c, 0xc0, 0x78, 0x0c, 0xf8, 0x30, 0x00},
44
        {0x00, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xc6, 0x00},
45
        {0x38, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0x76, 0x00},
46
        {0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00},
47
        {0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00},
48
        {0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00},
49
        {0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00},
50
        {0x00, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0x00},
51
        {0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x60},
52
        {0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00},
53
        {0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00},
54
        {0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00},
55
        {0x7c, 0xc6, 0xce, 0xde, 0xf6, 0xe6, 0x7c, 0x00},
56
        {0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00},
57
        {0x78, 0xcc, 0x0c, 0x38, 0x60, 0xcc, 0xfc, 0x00},
58
        {0x78, 0xcc, 0x0c, 0x38, 0x0c, 0xcc, 0x78, 0x00},
59
        {0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x1e, 0x00},
60
        {0xfc, 0xc0, 0xf8, 0x0c, 0x0c, 0xcc, 0x78, 0x00},
61
        {0x38, 0x60, 0xc0, 0xf8, 0xcc, 0xcc, 0x78, 0x00},
62
        {0xfc, 0xcc, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x00},
63
        {0x78, 0xcc, 0xcc, 0x78, 0xcc, 0xcc, 0x78, 0x00},
64
        {0x78, 0xcc, 0xcc, 0x7c, 0x0c, 0x18, 0x70, 0x00},
65
        {0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00},
66
        {0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x60},
67
        {0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x00},
68
        {0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00},
69
        {0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0x00},
70
        {0x78, 0xcc, 0x0c, 0x18, 0x30, 0x00, 0x30, 0x00},
71
        {0x7c, 0xc6, 0xde, 0xde, 0xde, 0xc0, 0x78, 0x00},
72
        {0x30, 0x78, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0x00},
73
        {0xfc, 0x66, 0x66, 0x7c, 0x66, 0x66, 0xfc, 0x00},
74
        {0x3c, 0x66, 0xc0, 0xc0, 0xc0, 0x66, 0x3c, 0x00},
75
        {0xf8, 0x6c, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00},
76
        {0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00},
77
        {0xfe, 0x62, 0x68, 0x78, 0x68, 0x60, 0xf0, 0x00},
78
        {0x3c, 0x66, 0xc0, 0xc0, 0xce, 0x66, 0x3e, 0x00},
79
        {0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0x00},
80
        {0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00},
81
        {0x1e, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78, 0x00},
82
        {0xe6, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0xe6, 0x00},
83
        {0xf0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00},
84
        {0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00},
85
        {0xc6, 0xe6, 0xf6, 0xde, 0xce, 0xc6, 0xc6, 0x00},
86
        {0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00},
87
        {0xfc, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00},
88
        {0x78, 0xcc, 0xcc, 0xcc, 0xdc, 0x78, 0x1c, 0x00},
89
        {0xfc, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0xe6, 0x00},
90
        {0x78, 0xcc, 0xe0, 0x70, 0x1c, 0xcc, 0x78, 0x00},
91
        {0xfc, 0xb4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00},
92
        {0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfc, 0x00},
93
        {0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00},
94
        {0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0xee, 0xc6, 0x00},
95
        {0xc6, 0xc6, 0x6c, 0x38, 0x38, 0x6c, 0xc6, 0x00},
96
        {0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x30, 0x78, 0x00},
97
        {0xfe, 0xc6, 0x8c, 0x18, 0x32, 0x66, 0xfe, 0x00},
98
        {0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00},
99
        {0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02, 0x00},
100
        {0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00},
101
        {0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00},
102
        {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff},
103
        {0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00},
104
        {0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00},
105
        {0xe0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0xdc, 0x00},
106
        {0x00, 0x00, 0x78, 0xcc, 0xc0, 0xcc, 0x78, 0x00},
107
        {0x1c, 0x0c, 0x0c, 0x7c, 0xcc, 0xcc, 0x76, 0x00},
108
        {0x00, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00},
109
        {0x38, 0x6c, 0x60, 0xf0, 0x60, 0x60, 0xf0, 0x00},
110
        {0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8},
111
        {0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0xe6, 0x00},
112
        {0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00},
113
        {0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78},
114
        {0xe0, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0xe6, 0x00},
115
        {0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00},
116
        {0x00, 0x00, 0xcc, 0xfe, 0xfe, 0xd6, 0xc6, 0x00},
117
        {0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0x00},
118
        {0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00},
119
        {0x00, 0x00, 0xdc, 0x66, 0x66, 0x7c, 0x60, 0xf0},
120
        {0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0x1e},
121
        {0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0xf0, 0x00},
122
        {0x00, 0x00, 0x7c, 0xc0, 0x78, 0x0c, 0xf8, 0x00},
123
        {0x10, 0x30, 0x7c, 0x30, 0x30, 0x34, 0x18, 0x00},
124
        {0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00},
125
        {0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00},
126
        {0x00, 0x00, 0xc6, 0xd6, 0xfe, 0xfe, 0x6c, 0x00},
127
        {0x00, 0x00, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x00},
128
        {0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8},
129
        {0x00, 0x00, 0xfc, 0x98, 0x30, 0x64, 0xfc, 0x00},
130
        {0x1c, 0x30, 0x30, 0xe0, 0x30, 0x30, 0x1c, 0x00},
131
        {0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00},
132
        {0xe0, 0x30, 0x30, 0x1c, 0x30, 0x30, 0xe0, 0x00},
133
        {0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
134
      };
135
 
136
#define memsetw(addr, val, n) {LIN_ADDR i; for(i = addr; i < addr + n; i += 2) *(WORD *)i = val;}
137
 
138
struct fb_info *grx_info = NULL;
486 giacomo 139
extern struct fb_info *registered_fb[FB_MAX];
485 giacomo 140
 
529 giacomo 141
void FB26_use_grx(int num)
485 giacomo 142
{
143
 
486 giacomo 144
  grx_info = registered_fb[num];
485 giacomo 145
 
146
}
147
 
148
void grx_putimage(WORD x1, WORD y1, WORD x2, WORD y2, BYTE *buf)
149
{
150
 
488 giacomo 151
  WORD bpr;
152
  LIN_ADDR addr, p;
153
  WORD dx, y;
485 giacomo 154
 
155
  if (!grx_info || grx_info->var.bits_per_pixel != 16) return;
156
 
488 giacomo 157
  bpr = grx_info->var.xres * 2;
158
  p = buf;
159
  addr = (LIN_ADDR)(grx_info->screen_base + x1 * 2 + bpr * y1);
160
  dx = (x2 - x1 + 1) * 2;
161
 
162
  for (y = y1; y <= y2; y++) {
163
    memcpy(addr, p, dx);
164
    p += dx;
165
    addr += bpr;
166
  }
485 giacomo 167
 
168
}
169
 
170
void grx_getimage(WORD x1, WORD y1, WORD x2, WORD y2, BYTE *buf)
171
{
172
    WORD bpr;
173
    LIN_ADDR addr, p;
174
    WORD dx, y;
175
 
176
    if (!grx_info || grx_info->var.bits_per_pixel != 16) return;
177
 
178
    bpr = grx_info->var.xres * 2;
179
    p = buf;
180
    addr = (LIN_ADDR)(grx_info->screen_base + x1 * 2 + bpr * y1);
181
    dx = (x2 - x1 + 1) * 2;
182
 
183
    for (y = y1; y <= y2; y++) {
184
        memcpy(p, addr, dx);
185
        p += dx;
186
        addr += bpr;
187
    }
188
 
189
}
190
 
191
void grx_box(WORD x1, WORD y1, WORD x2, WORD y2, DWORD color)
192
{
193
 
194
  if (!grx_info || grx_info->var.bits_per_pixel != 16) return;
195
 
488 giacomo 196
  WORD bpr;
197
  DWORD addr;
198
  WORD dx, y;
485 giacomo 199
 
488 giacomo 200
  bpr = grx_info->var.xres * 2;;
201
  addr = (DWORD)(grx_info->screen_base + x1 * 2 + bpr * y1);
202
  dx = (x2 - x1 + 1) * 2;
203
 
204
  for (y = y1; y <= y2; y++) {
205
    memsetw((LIN_ADDR)addr, color, dx);
206
    addr += bpr;
207
  }
485 giacomo 208
 
209
}
210
 
531 giacomo 211
void grx_clear(DWORD color)
212
{
213
  if (!grx_info || grx_info->var.bits_per_pixel != 16) return;
214
 
215
  DWORD addr;
216
  WORD dx, y;
217
 
218
  addr = (DWORD)(grx_info->screen_base);
219
  dx = grx_info->var.xres * 2;
220
 
221
  for (y = 0; y < grx_info->var.yres; y++) {
222
    memsetw((LIN_ADDR)addr, color, dx);
223
    addr += dx;
224
  }                                                                                                              
225
}
226
 
485 giacomo 227
void grx_rect(WORD x1, WORD y1, WORD x2, WORD y2, DWORD color)
228
{
229
    WORD bpr;
230
    DWORD addr;
231
    WORD dx, y;
232
 
233
    if (!grx_info || grx_info->var.bits_per_pixel != 16) return;
234
 
235
    bpr = grx_info->var.xres * 2;
236
    addr = (DWORD)(grx_info->screen_base + x1 * 2 + bpr * y1);
237
    dx = (x2 - x1) * 2;
238
 
239
    memsetw((LIN_ADDR)addr, color, dx+2);
240
    addr += bpr;
241
 
242
    for (y = y1 + 1; y <= y2 - 1; y++) {
243
        *(WORD *)addr = color;
244
        *(WORD *)(addr + dx) = color;
245
        addr += bpr;
246
    }
247
    memsetw((LIN_ADDR)addr, color, dx+2);
248
}
249
 
250
void grx_text(char *text, WORD x, WORD y, DWORD fg, DWORD bg)
251
{
252
    DWORD fp, addr;
253
    WORD bpr;
254
    int r, c, bits;
255
 
256
    if (!grx_info || grx_info->var.bits_per_pixel != 16) return;
257
 
258
    bpr = grx_info->var.xres * 2;
259
    addr = (DWORD)(grx_info->screen_base);
260
    while (*text) {
261
        fp = (DWORD)&(font_table[*(BYTE *)text][0]);
262
        for (r=0; r<8; r++) {
263
            bits = *(BYTE *)(fp++);
264
            for (c=0; c<8; c++)
265
                if (bits & (0x80>>c))
266
                    *(WORD *)(addr + (y + r) * bpr + ((x + c) * 2)) =  fg;
267
                else
268
                    *(WORD *)(addr + (y + r) * bpr + ((x + c) * 2)) = bg;
269
        }
270
        text++;
271
        x += 8;
272
    }
273
}
274
 
487 giacomo 275
void grx_line(WORD x1, WORD y1, WORD x2, WORD y2, DWORD color)
485 giacomo 276
{
277
    register int t, distance;
278
    register DWORD addr;
279
    register WORD bpr;
280
    int xerr=0, yerr=0, deltax, deltay;
281
    int incx, incy;
282
 
531 giacomo 283
    if (!grx_info || grx_info->var.bits_per_pixel != 16) return;
284
 
485 giacomo 285
    bpr = grx_info->var.xres * 2;
286
    addr = (DWORD)(grx_info->screen_base);
287
    deltax = x2 - x1;                   /* compute both distances */
288
    deltay = y2 - y1;
289
 
290
    if (deltax > 0)                     /* compute increments */
291
        incx = 1;
292
    else if (deltax == 0)
293
        incx = 0;
294
    else
295
        incx = -1;
296
 
297
    if (deltay > 0)
298
        incy = 1;
299
    else if (deltay == 0)
300
        incy = 0;
301
    else
302
        incy = -1;
303
 
304
    deltax = abs(deltax);               /* determine greater distance */
305
    deltay = abs(deltay);
306
    if (deltax > deltay)
307
        distance = deltax;
308
    else
309
        distance = deltay;
310
 
311
    for (t=0; t<=distance+1; t++) {     /* draw the line */
312
        *(WORD *)(addr + y1 * bpr + (x1 * 2)) = color;
313
        xerr += deltax;
314
        yerr += deltay;
315
        if (xerr > distance) {
316
            xerr -= distance;
317
            x1 += incx;
318
        }
319
        if (yerr > distance) {
320
            yerr -= distance;
321
            y1 += incy;
322
        }
323
    }
324
}
325
 
326
void grx_plot(WORD x, WORD y, DWORD color)
327
{
328
    WORD bpr;
329
 
330
    if (!grx_info || grx_info->var.bits_per_pixel != 16) return;
331
 
332
    bpr = grx_info->var.xres * 2;
333
    *(WORD *)(grx_info->screen_base + y * bpr + (x * 2)) = color;
334
}
335
 
336
DWORD grx_getpixel(WORD x, WORD y)
337
{
338
    WORD bpr;
339
    DWORD rv;
340
 
341
    if (!grx_info || grx_info->var.bits_per_pixel != 16) return -1;
342
 
343
    bpr = grx_info->var.xres * 2;
344
    rv = *(WORD *)(grx_info->screen_base + y * bpr + (x * 2));
345
    return rv;
346
 
347
}
348
 
349
static void circlepixels(WORD x, WORD y, WORD sx, WORD sy, DWORD c)
350
{
531 giacomo 351
 
352
    if (!grx_info || grx_info->var.bits_per_pixel != 16) return;
353
 
485 giacomo 354
    grx_plot(sx + x, sy + y, c);
355
    grx_plot(sx - x, sy + y, c);
356
    grx_plot(sx + x, sy - y, c);
357
    grx_plot(sx - x, sy - y, c);
358
    grx_plot(sx + y, sy + x, c);
359
    grx_plot(sx - y, sy + x, c);
360
    grx_plot(sx + y, sy - x, c);
361
    grx_plot(sx - y, sy - x, c);
362
}
363
 
364
void grx_circle(WORD sx, WORD sy, WORD r, DWORD c)
365
{
366
    int x, y, d;
367
 
368
    if (!grx_info || grx_info->var.bits_per_pixel != 16) return;
369
 
370
    if (r < 1) {
371
        grx_plot(sx, sy, c);
372
        return;
373
    }
374
 
375
    x = 0;
376
    y = r;
377
    d = 1 - r;
378
    circlepixels(x, y, sx, sy, c);
379
    while (x < y) {
380
        if (d < 0)
381
            d += x * 2 + 3;
382
        else {
383
            d += x * 2 - y * 2 + 5;
384
            y--;
385
        }
386
        x++;
387
        circlepixels(x, y, sx, sy, c);
388
    }
389
}
390
 
391
static __inline__ void discpixels(WORD x, WORD y, WORD sx, WORD sy, DWORD c)
392
{
531 giacomo 393
 
394
    if (!grx_info || grx_info->var.bits_per_pixel != 16) return;
395
 
485 giacomo 396
    grx_line(sx + x, sy + y, sx + x, sy - y, c);
397
    grx_line(sx - x, sy + y, sx - x, sy - y, c);
398
    grx_line(sx + y, sy + x, sx + y, sy - x , c);
399
    grx_line(sx - y, sy + x, sx - y, sy - x , c);
400
}
401
 
402
void grx_disc(WORD sx, WORD sy, WORD r, DWORD c)
403
{
404
    int x, y, d;
405
 
406
    if (!grx_info || grx_info->var.bits_per_pixel != 16) return;
407
 
408
    if (r < 1) {
409
        grx_plot(sx, sy, c);
410
        return;
411
    }
412
    x = 0;
413
    y = r;
414
    d = 1 - r;
415
    discpixels(x, y, sx, sy, c);
416
    while (x < y) {
417
        if (d < 0)
418
            d += x * 2 + 3;
419
        else {
420
            d += x * 2 - y * 2 + 5;
421
            y--;
422
        }
423
        x++;   
424
        discpixels(x, y, sx, sy, c);
425
    }
426
}
427