aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/engines/common/evas_map_image_internal.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-04 18:41:13 +1000
committerDavid Walter Seikel2012-01-04 18:41:13 +1000
commitdd7595a3475407a7fa96a97393bae8c5220e8762 (patch)
treee341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/evas/src/lib/engines/common/evas_map_image_internal.c
parentAdd the skeleton. (diff)
downloadSledjHamr-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_map_image_internal.c')
-rw-r--r--libraries/evas/src/lib/engines/common/evas_map_image_internal.c117
1 files changed, 117 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/engines/common/evas_map_image_internal.c b/libraries/evas/src/lib/engines/common/evas_map_image_internal.c
new file mode 100644
index 0000000..d60117e
--- /dev/null
+++ b/libraries/evas/src/lib/engines/common/evas_map_image_internal.c
@@ -0,0 +1,117 @@
1// 66.74 % of time
2static void
3FUNC_NAME(RGBA_Image *src, RGBA_Image *dst,
4 RGBA_Draw_Context *dc,
5 RGBA_Map_Point *p,
6 int smooth, int level __UNUSED__) // level unused for now - for future use
7{
8 int i;
9 int c, cx, cy, cw, ch;
10 int ytop, ybottom, ystart, yend, y, sw, shp, swp, direct;
11 Line *spans;
12 DATA32 *buf = NULL, *sp;
13 RGBA_Gfx_Func func = NULL;
14 int havea = 0;
15 int havecol = 4;
16
17 // get the clip
18 c = dc->clip.use; cx = dc->clip.x; cy = dc->clip.y; cw = dc->clip.w; ch = dc->clip.h;
19 if (!c)
20 {
21 cx = 0;
22 cy = 0;
23 cw = dst->cache_entry.w;
24 ch = dst->cache_entry.h;
25 }
26
27 // find y yop line and y bottom line
28 ytop = p[0].y;
29 if ((p[0].col >> 24) < 0xff) havea = 1;
30 if (p[0].col == 0xffffffff) havecol--;
31 for (i = 1; i < 4; i++)
32 {
33 if (p[i].y < ytop) ytop = p[i].y;
34 if ((p[i].col >> 24) < 0xff) havea = 1;
35 if (p[i].col == 0xffffffff) havecol--;
36 }
37
38 ybottom = p[0].y;
39 for (i = 1; i < 4; i++)
40 {
41 if (p[i].y > ybottom) ybottom = p[i].y;
42 }
43
44 // convert to screen space from fixed point
45 ytop = ytop >> FP;
46 ybottom = ybottom >> FP;
47
48 // if its outside the clip vertical bounds - don't bother
49 if ((ytop >= (cy + ch)) || (ybottom < cy)) return;
50
51 // limit to the clip vertical bounds
52 if (ytop < cy) ystart = cy;
53 else ystart = ytop;
54 if (ybottom >= (cy + ch)) yend = (cy + ch) - 1;
55 else yend = ybottom;
56
57 // get some source image information
58 sp = src->image.data;
59 sw = src->cache_entry.w;
60 swp = sw << (FP + FPI);
61 shp = src->cache_entry.h << (FP + FPI);
62
63 // limit u,v coords of points to be within the source image
64 for (i = 0; i < 4; i++)
65 {
66 if (p[i].u < 0) p[i].u = 0;
67 else if (p[i].u > (int)(src->cache_entry.w << FP))
68 p[i].u = src->cache_entry.w << FP;
69
70 if (p[i].v < 0) p[i].v = 0;
71 else if (p[i].v > (int)(src->cache_entry.h << FP))
72 p[i].v = src->cache_entry.h << FP;
73 }
74
75 // allocate some spans to hold out span list
76 spans = alloca((yend - ystart + 1) * sizeof(Line));
77 if (!spans) return;
78 memset(spans, 0, (yend - ystart + 1) * sizeof(Line));
79
80 // calculate the spans list
81 _calc_spans(p, spans, ystart, yend, cx, cy, cw, ch);
82
83 // walk through spans and render
84
85 // if operation is solid, bypass buf and draw func and draw direct to dst
86 direct = 0;
87 if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha) &&
88 (!dc->mul.use) && (!havea))
89 {
90 direct = 1;
91 }
92 else
93 {
94 int pa;
95
96 buf = alloca(cw * sizeof(DATA32));
97 if (!buf) return;
98 pa = src->cache_entry.flags.alpha;
99 if (havea) src->cache_entry.flags.alpha = 1;
100 if (dc->mul.use)
101 func = evas_common_gfx_func_composite_pixel_color_span_get(src, dc->mul.col, dst, cw, dc->render_op);
102 else
103 func = evas_common_gfx_func_composite_pixel_span_get(src, dst, cw, dc->render_op);
104 src->cache_entry.flags.alpha = pa;
105 }
106
107 if (!havecol)
108 {
109#undef COLMUL
110#include "evas_map_image_core.c"
111 }
112 else
113 {
114#define COLMUL 1
115#include "evas_map_image_core.c"
116 }
117}