aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/engines/common/evas_scale_smooth_scaler_downx.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/evas/src/lib/engines/common/evas_scale_smooth_scaler_downx.c')
-rw-r--r--libraries/evas/src/lib/engines/common/evas_scale_smooth_scaler_downx.c259
1 files changed, 259 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/engines/common/evas_scale_smooth_scaler_downx.c b/libraries/evas/src/lib/engines/common/evas_scale_smooth_scaler_downx.c
new file mode 100644
index 0000000..50b2e5c
--- /dev/null
+++ b/libraries/evas/src/lib/engines/common/evas_scale_smooth_scaler_downx.c
@@ -0,0 +1,259 @@
1{
2 int Cx, j;
3 DATA32 *pix, *dptr, *pbuf, **yp;
4 int r, g, b, a, rr, gg, bb, aa;
5 int *xp, xap, yap, pos;
6 int dyy, dxx;
7 int w = dst_clip_w;
8#ifdef EVAS_SLI
9 int ysli = dst_clip_y;
10#endif
11
12 dptr = dst_ptr;
13 pos = (src_region_y * src_w) + src_region_x;
14 dyy = dst_clip_y - dst_region_y;
15 dxx = dst_clip_x - dst_region_x;
16
17 xp = xpoints;// + dxx;
18 yp = ypoints;// + dyy;
19 xapp = xapoints;// + dxx;
20 yapp = yapoints;// + dyy;
21 pbuf = buf;
22
23 if (src->cache_entry.flags.alpha)
24 {
25 while (dst_clip_h--)
26 {
27#ifdef EVAS_SLI
28 if (((ysli) % dc->sli.h) == dc->sli.y)
29#endif
30 {
31 while (dst_clip_w--)
32 {
33 Cx = *xapp >> 16;
34 xap = *xapp & 0xffff;
35 pix = *yp + *xp + pos;
36
37 a = (A_VAL(pix) * xap) >> 10;
38 r = (R_VAL(pix) * xap) >> 10;
39 g = (G_VAL(pix) * xap) >> 10;
40 b = (B_VAL(pix) * xap) >> 10;
41 for (j = (1 << 14) - xap; j > Cx; j -= Cx)
42 {
43 pix++;
44 a += (A_VAL(pix) * Cx) >> 10;
45 r += (R_VAL(pix) * Cx) >> 10;
46 g += (G_VAL(pix) * Cx) >> 10;
47 b += (B_VAL(pix) * Cx) >> 10;
48 }
49 if (j > 0)
50 {
51 pix++;
52 a += (A_VAL(pix) * j) >> 10;
53 r += (R_VAL(pix) * j) >> 10;
54 g += (G_VAL(pix) * j) >> 10;
55 b += (B_VAL(pix) * j) >> 10;
56 }
57 if ((yap = *yapp) > 0)
58 {
59 pix = *yp + *xp + src_w + pos;
60 aa = (A_VAL(pix) * xap) >> 10;
61 rr = (R_VAL(pix) * xap) >> 10;
62 gg = (G_VAL(pix) * xap) >> 10;
63 bb = (B_VAL(pix) * xap) >> 10;
64 for (j = (1 << 14) - xap; j > Cx; j -= Cx)
65 {
66 pix++;
67 aa += (A_VAL(pix) * Cx) >> 10;
68 rr += (R_VAL(pix) * Cx) >> 10;
69 gg += (G_VAL(pix) * Cx) >> 10;
70 bb += (B_VAL(pix) * Cx) >> 10;
71 }
72 if (j > 0)
73 {
74 pix++;
75 aa += (A_VAL(pix) * j) >> 10;
76 rr += (R_VAL(pix) * j) >> 10;
77 gg += (G_VAL(pix) * j) >> 10;
78 bb += (B_VAL(pix) * j) >> 10;
79 }
80 a += ((aa - a) * yap) >> 8;
81 r += ((rr - r) * yap) >> 8;
82 g += ((gg - g) * yap) >> 8;
83 b += ((bb - b) * yap) >> 8;
84 }
85 *pbuf++ = ARGB_JOIN(((a + (1 << 3)) >> 4),
86 ((r + (1 << 3)) >> 4),
87 ((g + (1 << 3)) >> 4),
88 ((b + (1 << 3)) >> 4));
89 xp++; xapp++;
90 }
91
92 func(buf, NULL, dc->mul.col, dptr, w);
93 }
94#ifdef EVAS_SLI
95 ysli++;
96#endif
97 pbuf = buf;
98 dptr += dst_w; dst_clip_w = w;
99 yp++; yapp++;
100 xp = xpoints;// + dxx;
101 xapp = xapoints;// + dxx;
102 }
103 }
104 else
105 {
106#ifdef DIRECT_SCALE
107 if ((!src->cache_entry.flags.alpha) &&
108 (!dst->cache_entry.flags.alpha) &&
109 (!dc->mul.use))
110 {
111 while (dst_clip_h--)
112 {
113 pbuf = dptr;
114#ifdef EVAS_SLI
115 if (((ysli) % dc->sli.h) == dc->sli.y)
116#endif
117 {
118 while (dst_clip_w--)
119 {
120 Cx = *xapp >> 16;
121 xap = *xapp & 0xffff;
122 pix = *yp + *xp + pos;
123
124 r = (R_VAL(pix) * xap) >> 10;
125 g = (G_VAL(pix) * xap) >> 10;
126 b = (B_VAL(pix) * xap) >> 10;
127 for (j = (1 << 14) - xap; j > Cx; j -= Cx)
128 {
129 pix++;
130 r += (R_VAL(pix) * Cx) >> 10;
131 g += (G_VAL(pix) * Cx) >> 10;
132 b += (B_VAL(pix) * Cx) >> 10;
133 }
134 if (j > 0)
135 {
136 pix++;
137 r += (R_VAL(pix) * j) >> 10;
138 g += (G_VAL(pix) * j) >> 10;
139 b += (B_VAL(pix) * j) >> 10;
140 }
141 if ((yap = *yapp) > 0)
142 {
143 pix = *yp + *xp + src_w + pos;
144 rr = (R_VAL(pix) * xap) >> 10;
145 gg = (G_VAL(pix) * xap) >> 10;
146 bb = (B_VAL(pix) * xap) >> 10;
147 for (j = (1 << 14) - xap; j > Cx; j -= Cx)
148 {
149 pix++;
150 rr += (R_VAL(pix) * Cx) >> 10;
151 gg += (G_VAL(pix) * Cx) >> 10;
152 bb += (B_VAL(pix) * Cx) >> 10;
153 }
154 if (j > 0)
155 {
156 pix++;
157 rr += (R_VAL(pix) * j) >> 10;
158 gg += (G_VAL(pix) * j) >> 10;
159 bb += (B_VAL(pix) * j) >> 10;
160 }
161 r += ((rr - r) * yap) >> 8;
162 g += ((gg - g) * yap) >> 8;
163 b += ((bb - b) * yap) >> 8;
164 }
165 *pbuf++ = ARGB_JOIN(0xff,
166 ((r + (1 << 3)) >> 4),
167 ((g + (1 << 3)) >> 4),
168 ((b + (1 << 3)) >> 4));
169 xp++; xapp++;
170 }
171 }
172#ifdef EVAS_SLI
173 ysli++;
174#endif
175
176 dptr += dst_w; dst_clip_w = w;
177 yp++; yapp++;
178 xp = xpoints;// + dxx;
179 xapp = xapoints;// + dxx;
180 }
181 }
182 else
183#endif
184 {
185 while (dst_clip_h--)
186 {
187#ifdef EVAS_SLI
188 if (((ysli) % dc->sli.h) == dc->sli.y)
189#endif
190 {
191 while (dst_clip_w--)
192 {
193 Cx = *xapp >> 16;
194 xap = *xapp & 0xffff;
195 pix = *yp + *xp + pos;
196
197 r = (R_VAL(pix) * xap) >> 10;
198 g = (G_VAL(pix) * xap) >> 10;
199 b = (B_VAL(pix) * xap) >> 10;
200 for (j = (1 << 14) - xap; j > Cx; j -= Cx)
201 {
202 pix++;
203 r += (R_VAL(pix) * Cx) >> 10;
204 g += (G_VAL(pix) * Cx) >> 10;
205 b += (B_VAL(pix) * Cx) >> 10;
206 }
207 if (j > 0)
208 {
209 pix++;
210 r += (R_VAL(pix) * j) >> 10;
211 g += (G_VAL(pix) * j) >> 10;
212 b += (B_VAL(pix) * j) >> 10;
213 }
214 if ((yap = *yapp) > 0)
215 {
216 pix = *yp + *xp + src_w + pos;
217 rr = (R_VAL(pix) * xap) >> 10;
218 gg = (G_VAL(pix) * xap) >> 10;
219 bb = (B_VAL(pix) * xap) >> 10;
220 for (j = (1 << 14) - xap; j > Cx; j -= Cx)
221 {
222 pix++;
223 rr += (R_VAL(pix) * Cx) >> 10;
224 gg += (G_VAL(pix) * Cx) >> 10;
225 bb += (B_VAL(pix) * Cx) >> 10;
226 }
227 if (j > 0)
228 {
229 pix++;
230 rr += (R_VAL(pix) * j) >> 10;
231 gg += (G_VAL(pix) * j) >> 10;
232 bb += (B_VAL(pix) * j) >> 10;
233 }
234 r += ((rr - r) * yap) >> 8;
235 g += ((gg - g) * yap) >> 8;
236 b += ((bb - b) * yap) >> 8;
237 }
238 *pbuf++ = ARGB_JOIN(0xff,
239 ((r + (1 << 3)) >> 4),
240 ((g + (1 << 3)) >> 4),
241 ((b + (1 << 3)) >> 4));
242 xp++; xapp++;
243 }
244
245 func(buf, NULL, dc->mul.col, dptr, w);
246 }
247#ifdef EVAS_SLI
248 ysli++;
249#endif
250
251 pbuf = buf;
252 dptr += dst_w; dst_clip_w = w;
253 yp++; yapp++;
254 xp = xpoints;// + dxx;
255 xapp = xapoints;// + dxx;
256 }
257 }
258 }
259}