summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChunEon Park <hermet@hermet.pe.kr>2014-02-08 18:16:09 +0900
committerChunEon Park <hermet@hermet.pe.kr>2014-02-08 18:16:09 +0900
commitf0b1854d1056766be2ea4db59fff2e226e6c0358 (patch)
tree02bbee74bf3016aaf89ec2b4f6c9df6b0e1d2481 /src
parent738bcb07ff6f1e27e395c33f311fbbed1c128522 (diff)
evas/common - code clean up
add better descriptive comments. modify the code for better readibility.
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/common/evas_map_image.c2
-rw-r--r--src/lib/evas/common/evas_map_image_core.c87
2 files changed, 50 insertions, 39 deletions
diff --git a/src/lib/evas/common/evas_map_image.c b/src/lib/evas/common/evas_map_image.c
index 9eb4367a70..5001db49be 100644
--- a/src/lib/evas/common/evas_map_image.c
+++ b/src/lib/evas/common/evas_map_image.c
@@ -270,8 +270,8 @@ _calc_spans(RGBA_Map_Point *p, Line *spans, int ystart, int yend, int cx, int cy
270 col[i] = INTERP_256(t256, p[e2].col, p[e1].col); 270 col[i] = INTERP_256(t256, p[e2].col, p[e1].col);
271 271
272 // FIXME: store z persp 272 // FIXME: store z persp
273 uv[i][1] = v;
274 uv[i][0] = u; 273 uv[i][0] = u;
274 uv[i][1] = v;
275 edge[i][2] = x >> FP; 275 edge[i][2] = x >> FP;
276 edge[i][3] = x; 276 edge[i][3] = x;
277 // also fill in order 277 // also fill in order
diff --git a/src/lib/evas/common/evas_map_image_core.c b/src/lib/evas/common/evas_map_image_core.c
index 8899162fa3..e9479240ff 100644
--- a/src/lib/evas/common/evas_map_image_core.c
+++ b/src/lib/evas/common/evas_map_image_core.c
@@ -5,7 +5,7 @@
5 for (y = ystart; y <= yend; y++) 5 for (y = ystart; y <= yend; y++)
6 { 6 {
7 int x, w, ww; 7 int x, w, ww;
8 FPc u, v, ud, vd, dv, ue, ve; 8 FPc u, v, u2, v2, ud, vd, dv;
9 DATA32 *d, *s; 9 DATA32 *d, *s;
10#ifdef COLMUL 10#ifdef COLMUL
11 FPc cv, cd; // col 11 FPc cv, cd; // col
@@ -24,44 +24,47 @@
24 { 24 {
25 Span *span; 25 Span *span;
26 span = &(line->span[i]); 26 span = &(line->span[i]);
27
28 //The polygon shape won't be completed type
27 if (span->x1 < 0) break; 29 if (span->x1 < 0) break;
28 30
29 long long tl;
30 x = span->x1; 31 x = span->x1;
32
31 w = (span->x2 - x); 33 w = (span->x2 - x);
32 if (w <= 0) continue; 34 if (w <= 0) continue;
35
33 dv = (span->o2 - span->o1); 36 dv = (span->o2 - span->o1);
34 if (dv <= 0) continue; 37 if (dv <= 0) continue;
35 38
36 ww = w; 39 ww = w;
40
41 //correct elaborate u point
37 u = span->u[0] << FPI; 42 u = span->u[0] << FPI;
43 int z = u;
38 if (u < 0) u = 0; 44 if (u < 0) u = 0;
39 else if (u > swp) u = swp; 45 else if (u > swp) u = swp;
46 u2 = span->u[1] << FPI;
47 if (u2 < 0) u2 = 0;
48 else if (u2 > swp) u2 = swp;
49 ud = (u2 - u) / w;
50 ud = ((long long)ud * (w << FP)) / dv;
51 u -= (ud * (span->o1 - (span->x1 << FP))) / FP1;
52 if (ud < 0) u += ud;
53 if (u < 0) u = 0;
54 else if (u >= swp) u = swp - 1;
55
56 //correct elaborate v point
40 v = span->v[0] << FPI; 57 v = span->v[0] << FPI;
41 if (v < 0) v = 0; 58 if (v < 0) v = 0;
42 else if (v > shp) v = shp; 59 else if (v > shp) v = shp;
43 ue = span->u[1] << FPI; 60 int z2 = v;
44 if (ue < 0) ue = 0; 61 v2 = span->v[1] << FPI;
45 else if (ue > swp) ue = swp; 62 if (v2 < 0) v2 = 0;
46 ve = span->v[1] << FPI; 63 else if (v2 > shp) v2 = shp;
47 if (ve < 0) ve = 0; 64 vd = (v2 - v) / w;
48 else if (ve > shp) ve = shp; 65 vd = ((long long)vd * (w << FP)) / dv;
49 ud = (ue - u) / w;
50 vd = (ve - v) / w;
51 tl = (long long)ud * (w << FP);
52 tl = tl / dv;
53 ud = tl;
54 u -= (ud * (span->o1 - (span->x1 << FP))) / FP1;
55
56 tl = (long long)vd * (w << FP);
57 tl = tl / dv;
58 vd = tl;
59 v -= (vd * (span->o1 - (span->x1 << FP))) / FP1; 66 v -= (vd * (span->o1 - (span->x1 << FP))) / FP1;
60
61 if (ud < 0) u += ud;
62 if (vd < 0) v += vd; 67 if (vd < 0) v += vd;
63 if (u < 0) u = 0;
64 else if (u >= swp) u = swp - 1;
65 if (v < 0) v = 0; 68 if (v < 0) v = 0;
66 else if (v >= shp) v = shp - 1; 69 else if (v >= shp) v = shp - 1;
67 70
@@ -126,7 +129,7 @@
126 for (y = ystart; y <= yend; y++) 129 for (y = ystart; y <= yend; y++)
127 { 130 {
128 int x, w, ww; 131 int x, w, ww;
129 FPc u, v, ud, vd, ue, ve; 132 FPc u, v, u2, v2, ud, vd;
130 DATA32 *d, *s; 133 DATA32 *d, *s;
131#ifdef COLMUL 134#ifdef COLMUL
132 FPc cv, cd; // col 135 FPc cv, cd; // col
@@ -138,37 +141,45 @@
138 { 141 {
139 Span *span; 142 Span *span;
140 span = &(line->span[i]); 143 span = &(line->span[i]);
144
145 //The polygon shape won't be completed type
141 if (span->x1 < 0) break; 146 if (span->x1 < 0) break;
142 147
143 x = span->x1; 148 x = span->x1;
144 w = (span->x2 - x);
145 149
150 w = (span->x2 - x);
146 if (w <= 0) continue; 151 if (w <= 0) continue;
152
147 ww = w; 153 ww = w;
154
155 //correct elaborate u point
148 u = span->u[0] << FPI; 156 u = span->u[0] << FPI;
149 if (u < 0) u = 0; 157 if (u < 0) u = 0;
150 else if (u > swp) u = swp; 158 else if (u > swp) u = swp;
159 u2 = span->u[1] << FPI;
160 if (u2 < 0) u2 = 0;
161 else if (u2 > swp) u2 = swp;
162 ud = (u2 - u) / w;
163 if (ud < 0) u += ud;
164 if (u < 0) u = 0;
165 else if (u >= swp) u = swp - 1;
166
167 //correct elaborate v point
151 v = span->v[0] << FPI; 168 v = span->v[0] << FPI;
152 if (v < 0) v = 0; 169 if (v < 0) v = 0;
153 else if (v > shp) v = shp; 170 else if (v > shp) v = shp;
154 ue = span->u[1] << FPI; 171 v2 = span->v[1] << FPI;
155 if (ue < 0) ue = 0; 172 if (v2 < 0) v2 = 0;
156 else if (ue > swp) ue = swp; 173 else if (v2 > shp) v2 = shp;
157 ve = span->v[1] << FPI; 174 vd = (v2 - v) / w;
158 if (ve < 0) ve = 0; 175 if (vd < 0) v += vd;
159 else if (ve > shp) ve = shp; 176 if (v < 0) v = 0;
160 ud = (ue - u) / w; 177 else if (v >= shp) v = shp - 1;
161 vd = (ve - v) / w; 178
162 if (direct) 179 if (direct)
163 d = dst->image.data + (y * dst->cache_entry.w) + x; 180 d = dst->image.data + (y * dst->cache_entry.w) + x;
164 else 181 else
165 d = buf; 182 d = buf;
166 if (ud < 0) u += ud;
167 if (vd < 0) v += vd;
168 if (u < 0) u = 0;
169 else if (u >= swp) u = swp - 1;
170 if (v < 0) v = 0;
171 else if (v >= shp) v = shp - 1;
172#undef SMOOTH 183#undef SMOOTH
173#ifdef COLMUL 184#ifdef COLMUL
174 c1 = span->col[0]; // col 185 c1 = span->col[0]; // col