cz_step.c
1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include "graphic.h"
do_cz_step(mask)
int mask;
{
struct CZ *p, *d;
struct Iter_color *ip;
struct Color_depth *cd;
int color;
int r, g, b;
p = &cz_step[0].pnt;
d = &cz_step[0].del;
cd = &col_dep[0];
ip = &iter_color[0];
/*
if (debug) {
printf("cz_step pr %.3f, pg %.3f, pb %.3f.\n",
float_ewa( p->r), float_ewa( p->g), float_ewa( p->b));
printf("cz_step dr %.3f, dg %.3f, db %.3f.\n",
float_ewa( d->r), float_ewa( d->g), float_ewa( d->b));
}
*/
cd->d = /*int_ewa*/(p->z);
ip->r = int_ewa(p->r);
ip->g = int_ewa(p->g);
ip->b = int_ewa(p->b);
ip->a = int_ewa(p->a);
if (en_antialias) {
mask &= AA_SP_HALF;
} else {
mask &= AA_SP_CENTER;
}
if (mask & 0x00F0) {
cd->d += dzdy >> 1;
ip->r += drdy >> 1;
ip->g += dgdy >> 1;
ip->b += dbdy >> 1;
mask <<= AA_SP_COUNT*2;
} else
if (mask & 0x0F00) {
cd->d += dzdy >> 2;
ip->r += drdy >> 2;
ip->g += dgdy >> 2;
ip->b += dbdy >> 2;
mask <<= AA_SP_COUNT;
} else
if (mask & 0x000F) {
cd->d += (dzdy >> 2) + (dzdy >> 1);
ip->r += (drdy >> 2) + (drdy >> 1);
ip->g += (dgdy >> 2) + (dgdy >> 1);
ip->b += (dbdy >> 2) + (dbdy >> 1);
mask <<= AA_SP_COUNT*3;
}
if (mask & 0x2000) {
cd->d += dzdx >> 1;
ip->r += drdx >> 1;
ip->g += dgdx >> 1;
ip->b += dbdx >> 1;
} else
if (mask & 0x4000) {
cd->d += dzdx >> 2;
ip->r += drdx >> 2;
ip->g += dgdx >> 2;
ip->b += dbdx >> 2;
} else
if (mask & 0x1000) {
cd->d += (dzdx >> 2) + (dzdx >> 1);
ip->r += (drdx >> 2) + (drdx >> 1);
ip->g += (dgdx >> 2) + (dgdx >> 1);
ip->b += (dbdx >> 2) + (dbdx >> 1);
}
/*
if (debug)
printf("cz_step r %d, g %d, b %d.\n", r, g, b);
*/
p->r += d->r;
p->g += d->g;
p->b += d->b;
p->a += d->a;
p->z += d->z;
}