summaryrefslogtreecommitdiff
path: root/src/lib/ector/software/ector_software_gradient.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-10-20 16:36:20 -0700
committerCedric BAIL <cedric@osg.samsung.com>2015-11-09 10:42:35 -0800
commitdcc08940494b55d08fb90505698f37b0c5732cf8 (patch)
treef3936ca6d8f809a092ca17eb2541aa8270591538 /src/lib/ector/software/ector_software_gradient.c
parent9023f6d28c127373555339cd062f457f4ce7a9b6 (diff)
ector: cleanup code convention of the gradient code.
Diffstat (limited to 'src/lib/ector/software/ector_software_gradient.c')
-rw-r--r--src/lib/ector/software/ector_software_gradient.c213
1 files changed, 118 insertions, 95 deletions
diff --git a/src/lib/ector/software/ector_software_gradient.c b/src/lib/ector/software/ector_software_gradient.c
index 4a978e02cb..a68f77767e 100644
--- a/src/lib/ector/software/ector_software_gradient.c
+++ b/src/lib/ector/software/ector_software_gradient.c
@@ -16,19 +16,20 @@
16#define FIXPT_BITS 8 16#define FIXPT_BITS 8
17#define FIXPT_SIZE (1<<FIXPT_BITS) 17#define FIXPT_SIZE (1<<FIXPT_BITS)
18 18
19typedef void (*Radial_Helper_Func)(uint *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data, 19typedef void (*Ector_Radial_Helper_Func)(uint *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data,
20 float det, float delta_det, float delta_delta_det, float b, float delta_b); 20 float det, float delta_det, float delta_delta_det, float b, float delta_b);
21 21
22typedef void (*Linear_Helper_Func)(uint *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data, 22typedef void (*Ector_Linear_Helper_Func)(uint *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data,
23 int t_fixed, int inc_fixed); 23 int t_fixed, int inc_fixed);
24 24
25Radial_Helper_Func radial_helper; 25static Ector_Radial_Helper_Func _ector_radial_helper;
26Linear_Helper_Func linear_helper; 26static Ector_Linear_Helper_Func _ector_linear_helper;
27 27
28static inline int 28static inline int
29_gradient_clamp(const Ector_Renderer_Software_Gradient_Data *data, int ipos) 29_gradient_clamp(const Ector_Renderer_Software_Gradient_Data *data, int ipos)
30{ 30{
31 int limit; 31 int limit;
32
32 if (data->gd->s == EFL_GFX_GRADIENT_SPREAD_REPEAT) 33 if (data->gd->s == EFL_GFX_GRADIENT_SPREAD_REPEAT)
33 { 34 {
34 ipos = ipos % GRADIENT_STOPTABLE_SIZE; 35 ipos = ipos % GRADIENT_STOPTABLE_SIZE;
@@ -50,11 +51,11 @@ _gradient_clamp(const Ector_Renderer_Software_Gradient_Data *data, int ipos)
50 return ipos; 51 return ipos;
51} 52}
52 53
53
54static uint 54static uint
55_gradient_pixel_fixed(const Ector_Renderer_Software_Gradient_Data *data, int fixed_pos) 55_gradient_pixel_fixed(const Ector_Renderer_Software_Gradient_Data *data, int fixed_pos)
56{ 56{
57 int ipos = (fixed_pos + (FIXPT_SIZE / 2)) >> FIXPT_BITS; 57 int ipos = (fixed_pos + (FIXPT_SIZE / 2)) >> FIXPT_BITS;
58
58 return data->color_table[_gradient_clamp(data, ipos)]; 59 return data->color_table[_gradient_clamp(data, ipos)];
59} 60}
60 61
@@ -62,6 +63,7 @@ static inline uint
62_gradient_pixel(const Ector_Renderer_Software_Gradient_Data *data, float pos) 63_gradient_pixel(const Ector_Renderer_Software_Gradient_Data *data, float pos)
63{ 64{
64 int ipos = (int)(pos * (GRADIENT_STOPTABLE_SIZE - 1) + (float)(0.5)); 65 int ipos = (int)(pos * (GRADIENT_STOPTABLE_SIZE - 1) + (float)(0.5));
66
65 return data->color_table[_gradient_clamp(data, ipos)]; 67 return data->color_table[_gradient_clamp(data, ipos)];
66} 68}
67 69
@@ -70,8 +72,8 @@ _gradient_pixel(const Ector_Renderer_Software_Gradient_Data *data, float pos)
70#include <immintrin.h> 72#include <immintrin.h>
71 73
72#define GRADIENT_STOPTABLE_SIZE_SHIFT 10 74#define GRADIENT_STOPTABLE_SIZE_SHIFT 10
73typedef union{ __m128i v; int i[4];}vec4_i; 75typedef union { __m128i v; int i[4];} vec4_i;
74typedef union{ __m128 v; float f[4];}vec4_f; 76typedef union { __m128 v; float f[4];} vec4_f;
75 77
76#define FETCH_CLAMP_INIT_F \ 78#define FETCH_CLAMP_INIT_F \
77 __m128 v_min = _mm_set1_ps(0.0f); \ 79 __m128 v_min = _mm_set1_ps(0.0f); \
@@ -95,7 +97,6 @@ typedef union{ __m128 v; float f[4];}vec4_f;
95 vec4_i index_vec; \ 97 vec4_i index_vec; \
96 index_vec.v = _mm_cvttps_epi32(_mm_min_ps(v_max, _mm_max_ps(v_min, v_index))); 98 index_vec.v = _mm_cvttps_epi32(_mm_min_ps(v_max, _mm_max_ps(v_min, v_index)));
97 99
98
99#define FETCH_EPILOGUE_CPY \ 100#define FETCH_EPILOGUE_CPY \
100 *buffer++ = g_data->color_table[index_vec.i[0]]; \ 101 *buffer++ = g_data->color_table[index_vec.i[0]]; \
101 *buffer++ = g_data->color_table[index_vec.i[1]]; \ 102 *buffer++ = g_data->color_table[index_vec.i[1]]; \
@@ -103,31 +104,43 @@ typedef union{ __m128 v; float f[4];}vec4_f;
103 *buffer++ = g_data->color_table[index_vec.i[3]]; \ 104 *buffer++ = g_data->color_table[index_vec.i[3]]; \
104} 105}
105 106
106static void 107static void
107loop_break(unsigned int *buffer, int length, int *lprealign, int *lby4 , int *lremaining) 108loop_break(unsigned int *buffer, int length, int *lprealign, int *lby4 , int *lremaining)
108{ 109{
109 int l1=0,l2=0,l3=0; 110 int l1=0, l2=0, l3=0;
111
110 while ((uintptr_t)buffer & 0xF) 112 while ((uintptr_t)buffer & 0xF)
111 buffer++ , l1++; 113 buffer++ , l1++;
112 114
113 if(length <= l1) 115 if(length <= l1)
114 l1 = length; 116 {
117 l1 = length;
118 }
115 else 119 else
116 { 120 {
117 l3 = (length - l1)%4; 121 l3 = (length - l1) % 4;
118 l2 = length - l1 - l3 ; 122 l2 = length - l1 - l3 ;
119 } 123 }
124
120 *lprealign = l1; 125 *lprealign = l1;
121 *lby4 = l2; 126 *lby4 = l2;
122 *lremaining = l3; 127 *lremaining = l3;
123} 128}
124 129
125static void 130static void
126_radial_helper_sse3(uint *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data, 131_radial_helper_sse3(uint *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data,
127 float det, float delta_det, float delta_delta_det, float b, float delta_b) 132 float det, float delta_det, float delta_delta_det, float b, float delta_b)
128{ 133{
129 int lprealign, lby4, lremaining, i; 134 int lprealign, lby4, lremaining, i;
135 vec4_f det_vec;
136 vec4_f delta_det4_vec;
137 vec4_f b_vec;
138 __m128 v_delta_delta_det16;
139 __m128 v_delta_delta_det6;
140 __m128 v_delta_b4;
141
130 loop_break(buffer, length, &lprealign, &lby4, &lremaining); 142 loop_break(buffer, length, &lprealign, &lby4, &lremaining);
143
131 // prealign loop 144 // prealign loop
132 for (i = 0 ; i < lprealign ; i++) 145 for (i = 0 ; i < lprealign ; i++)
133 { 146 {
@@ -138,10 +151,6 @@ _radial_helper_sse3(uint *buffer, int length, Ector_Renderer_Software_Gradient_D
138 } 151 }
139 152
140 // lby4 16byte align loop 153 // lby4 16byte align loop
141 vec4_f det_vec;
142 vec4_f delta_det4_vec;
143 vec4_f b_vec;
144
145 for (i = 0; i < 4; ++i) 154 for (i = 0; i < 4; ++i)
146 { 155 {
147 det_vec.f[i] = det; 156 det_vec.f[i] = det;
@@ -153,37 +162,36 @@ _radial_helper_sse3(uint *buffer, int length, Ector_Renderer_Software_Gradient_D
153 b += delta_b; 162 b += delta_b;
154 } 163 }
155 164
156 __m128 v_delta_delta_det16 = _mm_set1_ps(16 * delta_delta_det); 165 v_delta_delta_det16 = _mm_set1_ps(16 * delta_delta_det);
157 __m128 v_delta_delta_det6 = _mm_set1_ps(6 * delta_delta_det); 166 v_delta_delta_det6 = _mm_set1_ps(6 * delta_delta_det);
158 __m128 v_delta_b4 = _mm_set1_ps(4 * delta_b); 167 v_delta_b4 = _mm_set1_ps(4 * delta_b);
159
160#define FETCH_RADIAL_PROLOGUE \
161 for (i = 0 ; i < lby4 ; i+=4) { \
162 __m128 v_index_local = _mm_sub_ps(_mm_sqrt_ps(det_vec.v), b_vec.v); \
163 __m128 v_index = _mm_add_ps(_mm_mul_ps(v_index_local, v_max), v_halff); \
164 det_vec.v = _mm_add_ps(_mm_add_ps(det_vec.v, delta_det4_vec.v), v_delta_delta_det6); \
165 delta_det4_vec.v = _mm_add_ps(delta_det4_vec.v, v_delta_delta_det16); \
166 b_vec.v = _mm_add_ps(b_vec.v, v_delta_b4);
167 168
169#define FETCH_RADIAL_PROLOGUE \
170 for (i = 0 ; i < lby4 ; i+=4) { \
171 __m128 v_index_local = _mm_sub_ps(_mm_sqrt_ps(det_vec.v), b_vec.v); \
172 __m128 v_index = _mm_add_ps(_mm_mul_ps(v_index_local, v_max), v_halff); \
173 det_vec.v = _mm_add_ps(_mm_add_ps(det_vec.v, delta_det4_vec.v), v_delta_delta_det6); \
174 delta_det4_vec.v = _mm_add_ps(delta_det4_vec.v, v_delta_delta_det16); \
175 b_vec.v = _mm_add_ps(b_vec.v, v_delta_b4);
168 176
169#define FETCH_RADIAL_LOOP(FETCH_CLAMP) \ 177#define FETCH_RADIAL_LOOP(FETCH_CLAMP) \
170 FETCH_RADIAL_PROLOGUE \ 178 FETCH_RADIAL_PROLOGUE; \
171 FETCH_CLAMP \ 179 FETCH_CLAMP; \
172 FETCH_EPILOGUE_CPY 180 FETCH_EPILOGUE_CPY;
173 181
174 FETCH_CLAMP_INIT_F 182 FETCH_CLAMP_INIT_F;
175 switch (g_data->gd->s) 183 switch (g_data->gd->s)
176 { 184 {
177 case EFL_GFX_GRADIENT_SPREAD_REPEAT: 185 case EFL_GFX_GRADIENT_SPREAD_REPEAT:
178 FETCH_RADIAL_LOOP(FETCH_CLAMP_REPEAT_F) 186 FETCH_RADIAL_LOOP(FETCH_CLAMP_REPEAT_F);
179 break; 187 break;
180 case EFL_GFX_GRADIENT_SPREAD_REFLECT: 188 case EFL_GFX_GRADIENT_SPREAD_REFLECT:
181 FETCH_RADIAL_LOOP( FETCH_CLAMP_REFLECT_F) 189 FETCH_RADIAL_LOOP( FETCH_CLAMP_REFLECT_F);
182 break; 190 break;
183 default: 191 default:
184 FETCH_RADIAL_LOOP(FETCH_CLAMP_PAD_F) 192 FETCH_RADIAL_LOOP(FETCH_CLAMP_PAD_F);
185 break; 193 break;
186 } 194 }
187 195
188 // remaining loop 196 // remaining loop
189 for (i = 0 ; i < lremaining ; i++) 197 for (i = 0 ; i < lremaining ; i++)
@@ -194,7 +202,17 @@ static void
194_linear_helper_sse3(uint *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data, int t, int inc) 202_linear_helper_sse3(uint *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data, int t, int inc)
195{ 203{
196 int lprealign, lby4, lremaining, i; 204 int lprealign, lby4, lremaining, i;
197 loop_break(buffer, length, &lprealign, &lby4, &lremaining); 205 vec4_i t_vec;
206 __m128i v_inc;
207 __m128i v_fxtpt_size;
208 __m128i v_min;
209 __m128i v_max;
210 __m128i v_repeat_mask;
211 __m128i v_reflect_mask;
212 __m128i v_reflect_limit;
213
214 loop_break(buffer, length, &lprealign, &lby4, &lremaining);
215
198 // prealign loop 216 // prealign loop
199 for (i = 0 ; i < lprealign ; i++) 217 for (i = 0 ; i < lprealign ; i++)
200 { 218 {
@@ -203,61 +221,58 @@ _linear_helper_sse3(uint *buffer, int length, Ector_Renderer_Software_Gradient_D
203 } 221 }
204 222
205 // lby4 16byte align loop 223 // lby4 16byte align loop
206 vec4_i t_vec;
207 for (i = 0; i < 4; ++i) 224 for (i = 0; i < 4; ++i)
208 { 225 {
209 t_vec.i[i] = t; 226 t_vec.i[i] = t;
210 t += inc; 227 t += inc;
211 } 228 }
212 229
213 __m128i v_inc = _mm_set1_epi32(4 * inc); 230 v_inc = _mm_set1_epi32(4 * inc);
214 __m128i v_fxtpt_size = _mm_set1_epi32(FIXPT_SIZE * 0.5); 231 v_fxtpt_size = _mm_set1_epi32(FIXPT_SIZE * 0.5);
215 232
216 __m128i v_min = _mm_set1_epi32(0); 233 v_min = _mm_set1_epi32(0);
217 __m128i v_max = _mm_set1_epi32((GRADIENT_STOPTABLE_SIZE-1)); 234 v_max = _mm_set1_epi32((GRADIENT_STOPTABLE_SIZE - 1));
218 235
219 __m128i v_repeat_mask = _mm_set1_epi32(~((uint)(0xffffff) << GRADIENT_STOPTABLE_SIZE_SHIFT)); 236 v_repeat_mask = _mm_set1_epi32(~((uint)(0xffffff) << GRADIENT_STOPTABLE_SIZE_SHIFT));
220 __m128i v_reflect_mask = _mm_set1_epi32(~((uint)(0xffffff) << (GRADIENT_STOPTABLE_SIZE_SHIFT+1))); 237 v_reflect_mask = _mm_set1_epi32(~((uint)(0xffffff) << (GRADIENT_STOPTABLE_SIZE_SHIFT + 1)));
221 238
222 __m128i v_reflect_limit = _mm_set1_epi32(2 * GRADIENT_STOPTABLE_SIZE - 1); 239 v_reflect_limit = _mm_set1_epi32(2 * GRADIENT_STOPTABLE_SIZE - 1);
223 240
224#define FETCH_LINEAR_LOOP_PROLOGUE \ 241#define FETCH_LINEAR_LOOP_PROLOGUE \
225 for (i = 0 ; i < lby4 ; i+=4) { \ 242 for (i = 0 ; i < lby4 ; i+=4) { \
226 vec4_i index_vec;\ 243 vec4_i index_vec; \
227 __m128i v_index;\ 244 __m128i v_index; \
228 v_index = _mm_srai_epi32(_mm_add_epi32(t_vec.v, v_fxtpt_size), FIXPT_BITS); \ 245 v_index = _mm_srai_epi32(_mm_add_epi32(t_vec.v, v_fxtpt_size), FIXPT_BITS); \
229 t_vec.v = _mm_add_epi32(t_vec.v, v_inc); 246 t_vec.v = _mm_add_epi32(t_vec.v, v_inc);
230 247
231#define FETCH_LINEAR_LOOP_CLAMP_REPEAT \ 248#define FETCH_LINEAR_LOOP_CLAMP_REPEAT \
232 index_vec.v = _mm_and_si128(v_repeat_mask, v_index); 249 index_vec.v = _mm_and_si128(v_repeat_mask, v_index);
233
234#define FETCH_LINEAR_LOOP_CLAMP_REFLECT \
235 __m128i v_index_i = _mm_and_si128(v_reflect_mask, v_index); \
236 __m128i v_index_i_inv = _mm_sub_epi32(v_reflect_limit, v_index_i); \
237 index_vec.v = _mm_min_epi16(v_index_i, v_index_i_inv);
238 250
239#define FETCH_LINEAR_LOOP_CLAMP_PAD \ 251#define FETCH_LINEAR_LOOP_CLAMP_REFLECT \
240 index_vec.v = _mm_min_epi16(v_max, _mm_max_epi16(v_min, v_index)); 252 __m128i v_index_i = _mm_and_si128(v_reflect_mask, v_index); \
253 __m128i v_index_i_inv = _mm_sub_epi32(v_reflect_limit, v_index_i); \
254 index_vec.v = _mm_min_epi16(v_index_i, v_index_i_inv);
241 255
256#define FETCH_LINEAR_LOOP_CLAMP_PAD \
257 index_vec.v = _mm_min_epi16(v_max, _mm_max_epi16(v_min, v_index));
242 258
259#define FETCH_LINEAR_LOOP(FETCH_LINEAR_LOOP_CLAMP) \
260 FETCH_LINEAR_LOOP_PROLOGUE; \
261 FETCH_LINEAR_LOOP_CLAMP; \
262 FETCH_EPILOGUE_CPY;
243 263
244#define FETCH_LINEAR_LOOP(FETCH_LINEAR_LOOP_CLAMP) \ 264 switch (g_data->gd->s)
245 FETCH_LINEAR_LOOP_PROLOGUE \ 265 {
246 FETCH_LINEAR_LOOP_CLAMP \
247 FETCH_EPILOGUE_CPY
248
249 switch (g_data->gd->s)
250 {
251 case EFL_GFX_GRADIENT_SPREAD_REPEAT: 266 case EFL_GFX_GRADIENT_SPREAD_REPEAT:
252 FETCH_LINEAR_LOOP(FETCH_LINEAR_LOOP_CLAMP_REPEAT) 267 FETCH_LINEAR_LOOP(FETCH_LINEAR_LOOP_CLAMP_REPEAT);
253 break; 268 break;
254 case EFL_GFX_GRADIENT_SPREAD_REFLECT: 269 case EFL_GFX_GRADIENT_SPREAD_REFLECT:
255 FETCH_LINEAR_LOOP(FETCH_LINEAR_LOOP_CLAMP_REFLECT) 270 FETCH_LINEAR_LOOP(FETCH_LINEAR_LOOP_CLAMP_REFLECT);
256 break; 271 break;
257 default: 272 default:
258 FETCH_LINEAR_LOOP(FETCH_LINEAR_LOOP_CLAMP_PAD) 273 FETCH_LINEAR_LOOP(FETCH_LINEAR_LOOP_CLAMP_PAD);
259 break; 274 break;
260 } 275 }
261 276
262 // remaining loop 277 // remaining loop
263 for (i = 0 ; i < lremaining ; i++) 278 for (i = 0 ; i < lremaining ; i++)
@@ -282,6 +297,7 @@ _generate_gradient_color_table(Efl_Gfx_Gradient_Stop *gradient_stops, int stop_c
282 Efl_Gfx_Gradient_Stop *curr, *next; 297 Efl_Gfx_Gradient_Stop *curr, *next;
283 uint current_color, next_color; 298 uint current_color, next_color;
284 double delta, t, incr, fpos; 299 double delta, t, incr, fpos;
300
285 assert(stop_count > 0); 301 assert(stop_count > 0);
286 302
287 curr = gradient_stops; 303 curr = gradient_stops;
@@ -301,12 +317,14 @@ _generate_gradient_color_table(Efl_Gfx_Gradient_Stop *gradient_stops, int stop_c
301 317
302 for (i = 0; i < stop_count - 1; ++i) 318 for (i = 0; i < stop_count - 1; ++i)
303 { 319 {
320 BLEND_FUNC func;
321
304 curr = (gradient_stops + i); 322 curr = (gradient_stops + i);
305 next = (gradient_stops + i + 1); 323 next = (gradient_stops + i + 1);
306 delta = 1/(next->offset - curr->offset); 324 delta = 1/(next->offset - curr->offset);
307 if (next->a != 255) alpha = EINA_TRUE; 325 if (next->a != 255) alpha = EINA_TRUE;
308 next_color = ECTOR_ARGB_JOIN(next->a, next->r, next->g, next->b); 326 next_color = ECTOR_ARGB_JOIN(next->a, next->r, next->g, next->b);
309 BLEND_FUNC func = &_ease_linear; 327 func = &_ease_linear;
310 while (fpos < next->offset && pos < size) 328 while (fpos < next->offset && pos < size)
311 { 329 {
312 t = func((fpos - curr->offset) * delta); 330 t = func((fpos - curr->offset) * delta);
@@ -334,7 +352,8 @@ update_color_table(Ector_Renderer_Software_Gradient_Data *gdata)
334 if (gdata->color_table) return; 352 if (gdata->color_table) return;
335 353
336 gdata->color_table = malloc(GRADIENT_STOPTABLE_SIZE * 4); 354 gdata->color_table = malloc(GRADIENT_STOPTABLE_SIZE * 4);
337 gdata->alpha = _generate_gradient_color_table(gdata->gd->colors, gdata->gd->colors_count, gdata->color_table, GRADIENT_STOPTABLE_SIZE); 355 gdata->alpha = _generate_gradient_color_table(gdata->gd->colors, gdata->gd->colors_count,
356 gdata->color_table, GRADIENT_STOPTABLE_SIZE);
338} 357}
339 358
340void 359void
@@ -352,6 +371,7 @@ _linear_helper_generic(uint *buffer, int length, Ector_Renderer_Software_Gradien
352 int t_fixed, int inc_fixed) 371 int t_fixed, int inc_fixed)
353{ 372{
354 int i; 373 int i;
374
355 for (i = 0 ; i < length ; i++) 375 for (i = 0 ; i < length ; i++)
356 { 376 {
357 *buffer++ = _gradient_pixel_fixed(g_data, t_fixed); 377 *buffer++ = _gradient_pixel_fixed(g_data, t_fixed);
@@ -366,6 +386,7 @@ fetch_linear_gradient(uint *buffer, Span_Data *data, int y, int x, int length)
366 float t, inc, rx=0, ry=0; 386 float t, inc, rx=0, ry=0;
367 uint *end; 387 uint *end;
368 int t_fixed, inc_fixed; 388 int t_fixed, inc_fixed;
389
369 if (g_data->linear.l == 0) 390 if (g_data->linear.l == 0)
370 { 391 {
371 t = inc = 0; 392 t = inc = 0;
@@ -394,7 +415,7 @@ fetch_linear_gradient(uint *buffer, Span_Data *data, int y, int x, int length)
394 // we can use fixed point math 415 // we can use fixed point math
395 t_fixed = (int)(t * FIXPT_SIZE); 416 t_fixed = (int)(t * FIXPT_SIZE);
396 inc_fixed = (int)(inc * FIXPT_SIZE); 417 inc_fixed = (int)(inc * FIXPT_SIZE);
397 linear_helper(buffer, length, g_data, t_fixed, inc_fixed); 418 _ector_linear_helper(buffer, length, g_data, t_fixed, inc_fixed);
398 } 419 }
399 else 420 else
400 { 421 {
@@ -415,6 +436,7 @@ _radial_helper_generic(uint *buffer, int length, Ector_Renderer_Software_Gradien
415 float delta_det, float delta_delta_det, float b, float delta_b) 436 float delta_det, float delta_delta_det, float b, float delta_b)
416{ 437{
417 int i; 438 int i;
439
418 for (i = 0 ; i < length ; i++) 440 for (i = 0 ; i < length ; i++)
419 { 441 {
420 *buffer++ = _gradient_pixel(g_data, sqrt(det) - b); 442 *buffer++ = _gradient_pixel(g_data, sqrt(det) - b);
@@ -431,6 +453,7 @@ fetch_radial_gradient(uint *buffer, Span_Data *data, int y, int x, int length)
431 float rx, ry, inv_a, delta_rx, delta_ry, b, delta_b, b_delta_b, delta_b_delta_b, 453 float rx, ry, inv_a, delta_rx, delta_ry, b, delta_b, b_delta_b, delta_b_delta_b,
432 bb, delta_bb, rxrxryry, delta_rxrxryry, rx_plus_ry, delta_rx_plus_ry, det, 454 bb, delta_bb, rxrxryry, delta_rxrxryry, rx_plus_ry, delta_rx_plus_ry, det,
433 delta_det, delta_delta_det; 455 delta_det, delta_delta_det;
456
434 // avoid division by zero 457 // avoid division by zero
435 if (fabsf(g_data->radial.a) <= 0.00001f) 458 if (fabsf(g_data->radial.a) <= 0.00001f)
436 { 459 {
@@ -470,20 +493,20 @@ fetch_radial_gradient(uint *buffer, Span_Data *data, int y, int x, int length)
470 delta_det = (b_delta_b + delta_bb + 4 * g_data->radial.a * (rx_plus_ry + delta_rxrxryry)) * inv_a; 493 delta_det = (b_delta_b + delta_bb + 4 * g_data->radial.a * (rx_plus_ry + delta_rxrxryry)) * inv_a;
471 delta_delta_det = (delta_b_delta_b + 4 * g_data->radial.a * delta_rx_plus_ry) * inv_a; 494 delta_delta_det = (delta_b_delta_b + 4 * g_data->radial.a * delta_rx_plus_ry) * inv_a;
472 495
473 radial_helper(buffer, length, g_data, det, delta_det, delta_delta_det, b, delta_b); 496 _ector_radial_helper(buffer, length, g_data, det, delta_det, delta_delta_det, b, delta_b);
474} 497}
475 498
476 499
477void 500void
478drawhelper_gradient_init() 501drawhelper_gradient_init()
479{ 502{
480 radial_helper = _radial_helper_generic; 503 _ector_radial_helper = _radial_helper_generic;
481 linear_helper = _linear_helper_generic; 504 _ector_linear_helper = _linear_helper_generic;
482 #ifdef BUILD_SSE3 505#ifdef BUILD_SSE3
483 if (eina_cpu_features_get() & EINA_CPU_SSE3) 506 if (eina_cpu_features_get() & EINA_CPU_SSE3)
484 { 507 {
485 radial_helper = _radial_helper_sse3; 508 _ector_radial_helper = _radial_helper_sse3;
486 linear_helper = _linear_helper_sse3; 509 _ector_linear_helper = _linear_helper_sse3;
487 } 510 }
488 #endif 511#endif
489} 512}