diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/evas/src/lib/engines/common/evas_scale_smooth_scaler_up.c | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2 SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz |
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/evas/src/lib/engines/common/evas_scale_smooth_scaler_up.c')
-rw-r--r-- | libraries/evas/src/lib/engines/common/evas_scale_smooth_scaler_up.c | 266 |
1 files changed, 266 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/engines/common/evas_scale_smooth_scaler_up.c b/libraries/evas/src/lib/engines/common/evas_scale_smooth_scaler_up.c new file mode 100644 index 0000000..7327ac5 --- /dev/null +++ b/libraries/evas/src/lib/engines/common/evas_scale_smooth_scaler_up.c | |||
@@ -0,0 +1,266 @@ | |||
1 | { | ||
2 | int srx = src_region_x, sry = src_region_y; | ||
3 | int srw = src_region_w, srh = src_region_h; | ||
4 | int drx = dst_region_x, dry = dst_region_y; | ||
5 | int drw = dst_region_w, drh = dst_region_h; | ||
6 | |||
7 | int dsxx, dsyy, sxx, syy, sx, sy; | ||
8 | int cx, cy; | ||
9 | int direct_scale = 0, buf_step = 0; | ||
10 | |||
11 | DATA32 *psrc, *pdst, *pdst_end; | ||
12 | DATA32 *buf, *pbuf, *pbuf_end; | ||
13 | RGBA_Gfx_Func func = NULL; | ||
14 | |||
15 | /* check value to make overflow(only check value related with overflow) */ | ||
16 | if ((src_region_w > SCALE_SIZE_MAX) || | ||
17 | (src_region_h > SCALE_SIZE_MAX)) return; | ||
18 | |||
19 | /* a scanline buffer */ | ||
20 | pdst = dst_ptr; // it's been set at (dst_clip_x, dst_clip_y) | ||
21 | pdst_end = pdst + (dst_clip_h * dst_w); | ||
22 | if (!dc->mul.use) | ||
23 | { | ||
24 | if ((dc->render_op == _EVAS_RENDER_BLEND) && !src->cache_entry.flags.alpha) | ||
25 | { direct_scale = 1; buf_step = dst->cache_entry.w; } | ||
26 | else if (dc->render_op == _EVAS_RENDER_COPY) | ||
27 | { | ||
28 | direct_scale = 1; buf_step = dst->cache_entry.w; | ||
29 | if (src->cache_entry.flags.alpha) | ||
30 | dst->cache_entry.flags.alpha = 1; | ||
31 | } | ||
32 | } | ||
33 | if (!direct_scale) | ||
34 | { | ||
35 | buf = alloca(dst_clip_w * sizeof(DATA32)); | ||
36 | if (dc->mul.use) | ||
37 | func = evas_common_gfx_func_composite_pixel_color_span_get(src, dc->mul.col, dst, dst_clip_w, dc->render_op); | ||
38 | else | ||
39 | func = evas_common_gfx_func_composite_pixel_span_get(src, dst, dst_clip_w, dc->render_op); | ||
40 | } | ||
41 | else | ||
42 | buf = pdst; | ||
43 | |||
44 | if ((srw > 1) && (drw > 1)) | ||
45 | dsxx = ((srw - 1) << 16) / (drw - 1); | ||
46 | else | ||
47 | dsxx = (srw << 16) / drw; | ||
48 | if ((srh > 1) && (drh > 1)) | ||
49 | dsyy = ((srh - 1) << 16) / (drh - 1); | ||
50 | else | ||
51 | dsyy = (srh << 16) / drh; | ||
52 | |||
53 | cx = dst_clip_x - drx; | ||
54 | cy = dst_clip_y - dry; | ||
55 | |||
56 | sxx = (dsxx * cx); | ||
57 | syy = (dsyy * cy); | ||
58 | |||
59 | sy = syy >> 16; | ||
60 | |||
61 | if (drh == srh) | ||
62 | { | ||
63 | int sxx0 = sxx; | ||
64 | #ifdef EVAS_SLI | ||
65 | int ysli = dst_clip_y; | ||
66 | #endif | ||
67 | psrc = src->image.data + (src_w * (sry + cy)) + srx; | ||
68 | while (pdst < pdst_end) | ||
69 | { | ||
70 | #ifdef EVAS_SLI | ||
71 | if (((ysli) % dc->sli.h) == dc->sli.y) | ||
72 | #endif | ||
73 | { | ||
74 | pbuf = buf; pbuf_end = buf + dst_clip_w; | ||
75 | sxx = sxx0; | ||
76 | #ifdef SCALE_USING_MMX | ||
77 | pxor_r2r(mm0, mm0); | ||
78 | MOV_A2R(ALPHA_255, mm5) | ||
79 | #endif | ||
80 | while (pbuf < pbuf_end) | ||
81 | { | ||
82 | DATA32 p0, p1; | ||
83 | int ax; | ||
84 | |||
85 | sx = (sxx >> 16); | ||
86 | ax = 1 + ((sxx - (sx << 16)) >> 8); | ||
87 | p0 = p1 = *(psrc + sx); | ||
88 | if ((sx + 1) < srw) | ||
89 | p1 = *(psrc + sx + 1); | ||
90 | #ifdef SCALE_USING_MMX | ||
91 | MOV_P2R(p0, mm1, mm0) | ||
92 | if (p0 | p1) | ||
93 | { | ||
94 | MOV_A2R(ax, mm3) | ||
95 | MOV_P2R(p1, mm2, mm0) | ||
96 | INTERP_256_R2R(mm3, mm2, mm1, mm5) | ||
97 | } | ||
98 | MOV_R2P(mm1, *pbuf, mm0) | ||
99 | pbuf++; | ||
100 | #else | ||
101 | if (p0 | p1) | ||
102 | p0 = INTERP_256(ax, p1, p0); | ||
103 | *pbuf++ = p0; | ||
104 | #endif | ||
105 | sxx += dsxx; | ||
106 | } | ||
107 | /* * blend here [clip_w *] buf -> dptr * */ | ||
108 | if (!direct_scale) | ||
109 | func(buf, NULL, dc->mul.col, pdst, dst_clip_w); | ||
110 | } | ||
111 | #ifdef EVAS_SLI | ||
112 | ysli++; | ||
113 | #endif | ||
114 | pdst += dst_w; | ||
115 | psrc += src_w; | ||
116 | buf += buf_step; | ||
117 | } | ||
118 | |||
119 | goto done_scale_up; | ||
120 | } | ||
121 | else if (drw == srw) | ||
122 | { | ||
123 | DATA32 *ps = src->image.data + (src_w * sry) + srx + cx; | ||
124 | #ifdef EVAS_SLI | ||
125 | int ysli = dst_clip_y; | ||
126 | #endif | ||
127 | |||
128 | while (pdst < pdst_end) | ||
129 | { | ||
130 | #ifdef EVAS_SLI | ||
131 | if (((ysli) % dc->sli.h) == dc->sli.y) | ||
132 | #endif | ||
133 | { | ||
134 | int ay; | ||
135 | |||
136 | sy = syy >> 16; | ||
137 | psrc = ps + (sy * src_w); | ||
138 | ay = 1 + ((syy - (sy << 16)) >> 8); | ||
139 | #ifdef SCALE_USING_MMX | ||
140 | pxor_r2r(mm0, mm0); | ||
141 | MOV_A2R(ALPHA_255, mm5) | ||
142 | MOV_A2R(ay, mm4) | ||
143 | #endif | ||
144 | pbuf = buf; pbuf_end = buf + dst_clip_w; | ||
145 | while (pbuf < pbuf_end) | ||
146 | { | ||
147 | DATA32 p0 = *psrc, p2 = p0; | ||
148 | |||
149 | if ((sy + 1) < srh) | ||
150 | p2 = *(psrc + src_w); | ||
151 | #ifdef SCALE_USING_MMX | ||
152 | MOV_P2R(p0, mm1, mm0) | ||
153 | if (p0 | p2) | ||
154 | { | ||
155 | MOV_P2R(p2, mm2, mm0) | ||
156 | INTERP_256_R2R(mm4, mm2, mm1, mm5) | ||
157 | } | ||
158 | MOV_R2P(mm1, *pbuf, mm0) | ||
159 | pbuf++; | ||
160 | #else | ||
161 | if (p0 | p2) | ||
162 | p0 = INTERP_256(ay, p2, p0); | ||
163 | *pbuf++ = p0; | ||
164 | #endif | ||
165 | psrc++; | ||
166 | } | ||
167 | /* * blend here [clip_w *] buf -> dptr * */ | ||
168 | if (!direct_scale) | ||
169 | func(buf, NULL, dc->mul.col, pdst, dst_clip_w); | ||
170 | } | ||
171 | #ifdef EVAS_SLI | ||
172 | ysli++; | ||
173 | #endif | ||
174 | pdst += dst_w; | ||
175 | syy += dsyy; | ||
176 | buf += buf_step; | ||
177 | } | ||
178 | goto done_scale_up; | ||
179 | } | ||
180 | |||
181 | { | ||
182 | DATA32 *ps = src->image.data + (src_w * sry) + srx; | ||
183 | int sxx0 = sxx; | ||
184 | #ifdef EVAS_SLI | ||
185 | int ysli = dst_clip_y; | ||
186 | #endif | ||
187 | |||
188 | while (pdst < pdst_end) | ||
189 | { | ||
190 | #ifdef EVAS_SLI | ||
191 | if (((ysli) % dc->sli.h) == dc->sli.y) | ||
192 | #endif | ||
193 | { | ||
194 | int ay; | ||
195 | |||
196 | sy = syy >> 16; | ||
197 | psrc = ps + (sy * src_w); | ||
198 | ay = 1 + ((syy - (sy << 16)) >> 8); | ||
199 | #ifdef SCALE_USING_MMX | ||
200 | MOV_A2R(ay, mm4) | ||
201 | pxor_r2r(mm0, mm0); | ||
202 | MOV_A2R(ALPHA_255, mm5) | ||
203 | #endif | ||
204 | pbuf = buf; pbuf_end = buf + dst_clip_w; | ||
205 | sxx = sxx0; | ||
206 | while (pbuf < pbuf_end) | ||
207 | { | ||
208 | int ax; | ||
209 | DATA32 *p, *q; | ||
210 | DATA32 p0, p1, p2, p3; | ||
211 | |||
212 | sx = sxx >> 16; | ||
213 | ax = 1 + ((sxx - (sx << 16)) >> 8); | ||
214 | p = psrc + sx; q = p + src_w; | ||
215 | p0 = p1 = p2 = p3 = *p; | ||
216 | if ((sx + 1) < srw) | ||
217 | p1 = *(p + 1); | ||
218 | if ((sy + 1) < srh) | ||
219 | { | ||
220 | p2 = *q; p3 = p2; | ||
221 | if ((sx + 1) < srw) | ||
222 | p3 = *(q + 1); | ||
223 | } | ||
224 | #ifdef SCALE_USING_MMX | ||
225 | MOV_A2R(ax, mm6) | ||
226 | MOV_P2R(p0, mm1, mm0) | ||
227 | if (p0 | p1) | ||
228 | { | ||
229 | MOV_P2R(p1, mm2, mm0) | ||
230 | INTERP_256_R2R(mm6, mm2, mm1, mm5) | ||
231 | } | ||
232 | MOV_P2R(p2, mm2, mm0) | ||
233 | if (p2 | p3) | ||
234 | { | ||
235 | MOV_P2R(p3, mm3, mm0) | ||
236 | INTERP_256_R2R(mm6, mm3, mm2, mm5) | ||
237 | } | ||
238 | INTERP_256_R2R(mm4, mm2, mm1, mm5) | ||
239 | MOV_R2P(mm1, *pbuf, mm0) | ||
240 | pbuf++; | ||
241 | #else | ||
242 | if (p0 | p1) | ||
243 | p0 = INTERP_256(ax, p1, p0); | ||
244 | if (p2 | p3) | ||
245 | p2 = INTERP_256(ax, p3, p2); | ||
246 | if (p0 | p2) | ||
247 | p0 = INTERP_256(ay, p2, p0); | ||
248 | *pbuf++ = p0; | ||
249 | #endif | ||
250 | sxx += dsxx; | ||
251 | } | ||
252 | /* * blend here [clip_w *] buf -> dptr * */ | ||
253 | if (!direct_scale) | ||
254 | func(buf, NULL, dc->mul.col, pdst, dst_clip_w); | ||
255 | } | ||
256 | #ifdef EVAS_SLI | ||
257 | ysli++; | ||
258 | #endif | ||
259 | pdst += dst_w; | ||
260 | syy += dsyy; | ||
261 | buf += buf_step; | ||
262 | } | ||
263 | } | ||
264 | done_scale_up: | ||
265 | return; | ||
266 | } | ||