diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/evas/src/lib/include/evas_common_soft8.h | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/include/evas_common_soft8.h b/libraries/evas/src/lib/include/evas_common_soft8.h new file mode 100644 index 0000000..d701842 --- /dev/null +++ b/libraries/evas/src/lib/include/evas_common_soft8.h | |||
@@ -0,0 +1,184 @@ | |||
1 | #ifndef EVAS_COMMON_SOFT8_H | ||
2 | #define EVAS_COMMON_SOFT8_H | ||
3 | |||
4 | #include "evas_common.h" | ||
5 | #include "evas_private.h" | ||
6 | |||
7 | #ifdef __cplusplus | ||
8 | extern "C" { | ||
9 | #endif | ||
10 | |||
11 | #define GRY_8_BLEND(a, b, alpha) \ | ||
12 | ((b) + (a) - ((((b) * ((alpha) + 1)) >> 8) & 0xff)) | ||
13 | |||
14 | #define GRY_8_BLEND_UNMUL(a, b, alpha) \ | ||
15 | ((b) + ((((a) - (b)) * ((alpha) + 1)) >> 8)) | ||
16 | |||
17 | #if 0 | ||
18 | #define GRY_8_FROM_COMPONENTS(r, g, b) \ | ||
19 | (((307 * (r)) + \ | ||
20 | (604 * (g)) + \ | ||
21 | (113 * (b))) >> 10) | ||
22 | |||
23 | #define GRY_8_FROM_RGB(rgb) \ | ||
24 | GRY_8_FROM_COMPONENTS(R_VAL(rgb), G_VAL(rgb), B_VAL(rgb)) | ||
25 | #endif | ||
26 | |||
27 | //Y = R * 0.2126 + G * 0.7152 + B * 0.0722 | ||
28 | |||
29 | #define GRY_8_FROM_COMPONENTS(r, g, b) \ | ||
30 | (((218 * (r)) + \ | ||
31 | (732 * (g)) + \ | ||
32 | (74 * (b))) >> 10) | ||
33 | |||
34 | #define GRY_8_FROM_RGB(rgb) \ | ||
35 | GRY_8_FROM_COMPONENTS(R_VAL(rgb), G_VAL(rgb), B_VAL(rgb)) | ||
36 | |||
37 | #define UNROLL2(op...) op op | ||
38 | #define UNROLL4(op...) UNROLL2(op) UNROLL2(op) | ||
39 | #define UNROLL8(op...) UNROLL4(op) UNROLL4(op) | ||
40 | #define UNROLL16(op...) UNROLL8(op) UNROLL8(op) | ||
41 | |||
42 | #if defined(__ARM_ARCH_3M__) | ||
43 | # define __ARM_ARCH__ 40 | ||
44 | #endif | ||
45 | #if defined(__ARM_ARCH_4__) | ||
46 | # define __ARM_ARCH__ 40 | ||
47 | #endif | ||
48 | #if defined(__ARM_ARCH_4T__) | ||
49 | # define __ARM_ARCH__ 41 | ||
50 | #endif | ||
51 | |||
52 | #if defined(__ARM_ARCH_5__) | ||
53 | # define __ARM_ARCH__ 50 | ||
54 | #endif | ||
55 | #if defined(__ARM_ARCH_5T__) | ||
56 | # define __ARM_ARCH__ 51 | ||
57 | #endif | ||
58 | #if defined(__ARM_ARCH_5E__) | ||
59 | # define __ARM_ARCH__ 52 | ||
60 | #endif | ||
61 | #if defined(__ARM_ARCH_5TE__) | ||
62 | # define __ARM_ARCH__ 53 | ||
63 | #endif | ||
64 | #if defined(__ARM_ARCH_5TEJ__) | ||
65 | # define __ARM_ARCH__ 54 | ||
66 | #endif | ||
67 | |||
68 | #if defined(__ARM_ARCH_6__) | ||
69 | # define __ARM_ARCH__ 60 | ||
70 | #endif | ||
71 | #if defined(__ARM_ARCH_6J__) | ||
72 | # define __ARM_ARCH__ 61 | ||
73 | #endif | ||
74 | #if defined(__ARM_ARCH_6K__) | ||
75 | # define __ARM_ARCH__ 62 | ||
76 | #endif | ||
77 | #if defined(__ARM_ARCH_6Z__) | ||
78 | # define __ARM_ARCH__ 63 | ||
79 | #endif | ||
80 | #if defined(__ARM_ARCH_6ZK__) | ||
81 | # define __ARM_ARCH__ 64 | ||
82 | #endif | ||
83 | #if defined(__ARM_ARCH_6T2__) | ||
84 | # define __ARM_ARCH__ 65 | ||
85 | #endif | ||
86 | |||
87 | #if defined(__ARM_ARCH_7__) | ||
88 | # define __ARM_ARCH__ 70 | ||
89 | #endif | ||
90 | #if defined(__ARM_ARCH_7A__) | ||
91 | # define __ARM_ARCH__ 71 | ||
92 | #endif | ||
93 | #if defined(__ARM_ARCH_7R__) | ||
94 | # define __ARM_ARCH__ 72 | ||
95 | #endif | ||
96 | #if defined(__ARM_ARCH_7M__) | ||
97 | # define __ARM_ARCH__ 73 | ||
98 | #endif | ||
99 | |||
100 | #if defined(__ARM_ARCH__) && (__ARM_ARCH__ >= 52) | ||
101 | /* tested on ARMv6 (arm1136j-s), Nokia N800 CPU */ | ||
102 | #define pld(addr, off) \ | ||
103 | __asm__("pld [%[address], %[offset]]":: \ | ||
104 | [address] "r" (addr), [offset] "i" (off)) | ||
105 | #else | ||
106 | #define pld(addr, off) | ||
107 | #endif /* __ARMEL__ */ | ||
108 | |||
109 | static inline unsigned int | ||
110 | _calc_stride(unsigned int w) | ||
111 | { | ||
112 | unsigned int pad = w % 4; | ||
113 | if (!pad) return w; | ||
114 | else return w + 4 - pad; | ||
115 | } | ||
116 | |||
117 | #define IMG_BYTE_SIZE(stride, height, has_alpha) \ | ||
118 | ((stride) * (height) * (!(has_alpha) ? 1 : 2)) | ||
119 | |||
120 | typedef struct _Soft8_Image Soft8_Image; | ||
121 | struct _Soft8_Image | ||
122 | { | ||
123 | Image_Entry cache_entry; | ||
124 | |||
125 | RGBA_Image *source; | ||
126 | |||
127 | int stride; // pixel stride | ||
128 | DATA8 *pixels; // 8bpp pixels gry8 | ||
129 | DATA8 *alpha; // 8bit alpha mask - optional. points into pixels | ||
130 | |||
131 | void *extended_info; | ||
132 | |||
133 | struct | ||
134 | { | ||
135 | /* unsigned char have_alpha : 1; // 1 if we have halpha */ | ||
136 | unsigned char free_pixels : 1; // 1 if pixels should be freed | ||
137 | unsigned char free_alpha : 1; // 1 if alpha mask should be freed | ||
138 | } flags; | ||
139 | }; | ||
140 | |||
141 | /** | ||
142 | * Image (evas_soft8_main.c) | ||
143 | */ | ||
144 | EAPI void evas_common_soft8_image_init(void); | ||
145 | EAPI void evas_common_soft8_image_shutdown(void); | ||
146 | EAPI Evas_Cache_Image *evas_common_soft8_image_cache_get(void); | ||
147 | |||
148 | EAPI void evas_common_soft8_image_draw(Soft8_Image *src, Soft8_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, int smooth); | ||
149 | EAPI Soft8_Image *evas_common_soft8_image_alpha_set(Soft8_Image *im, int have_alpha); | ||
150 | |||
151 | void evas_common_soft8_image_draw_unscaled(Soft8_Image *src, Soft8_Image *dst, RGBA_Draw_Context *dc, const Eina_Rectangle sr, const Eina_Rectangle dr, const Eina_Rectangle cr); | ||
152 | void evas_common_soft8_image_draw_scaled_sampled(Soft8_Image *src, Soft8_Image *dst, RGBA_Draw_Context *dc, const Eina_Rectangle sr, const Eina_Rectangle dr, const Eina_Rectangle cr); | ||
153 | |||
154 | /* convert/dither functions */ | ||
155 | void evas_common_soft8_image_convert_from_rgb(Soft8_Image *im, const DATA32 *src); | ||
156 | void evas_common_soft8_image_convert_from_rgba(Soft8_Image *im, const DATA32 *src); | ||
157 | |||
158 | /** | ||
159 | * Rectangle (evas_soft8_rectangle.c) | ||
160 | */ | ||
161 | EAPI void evas_common_soft8_rectangle_draw(Soft8_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h); | ||
162 | |||
163 | /** | ||
164 | * Polygon (evas_soft8_polygon.c) | ||
165 | */ | ||
166 | EAPI void evas_common_soft8_polygon_draw(Soft8_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Point *points, int x, int y); | ||
167 | |||
168 | /** | ||
169 | * Line (evas_soft8_line.c) | ||
170 | */ | ||
171 | EAPI void evas_common_soft8_line_draw(Soft8_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1); | ||
172 | |||
173 | /** | ||
174 | * Font (evas_soft8_font.c) | ||
175 | */ | ||
176 | EAPI void *evas_common_soft8_font_glyph_new(void *data, RGBA_Font_Glyph *fg); | ||
177 | EAPI void evas_common_soft8_font_glyph_free(void *ext_dat); | ||
178 | EAPI void evas_common_soft8_font_glyph_draw(void *data, void *dest, void *context, RGBA_Font_Glyph *fg, int x, int y); | ||
179 | |||
180 | #ifdef __cplusplus | ||
181 | } | ||
182 | #endif | ||
183 | |||
184 | #endif | ||