summaryrefslogtreecommitdiff
path: root/src/lib/ector/software/ector_software_gradient.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-12-02 18:46:29 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-12-03 18:42:50 +0900
commit615b2442b76eeeeacc3e386ca5fd322047009761 (patch)
treea84d36df1ff9460dc78123763a75f507a4750353 /src/lib/ector/software/ector_software_gradient.c
parentbad7911cd0f9d7eaa51c0c7b67ff3ed8d7da5599 (diff)
Ector: Move drawhelper to static_libs
Rename a few things: - draw helper -> efl_draw - Ector_Rop -> Efl.Gfx.Render_Op - ECTOR_ bla bla -> DRAW_ bla bla (base pixel ops) - ector_memfill -> draw_memset32 (and invert arg order to match memset) The main rasterizer file is now draw.h in static_libs/draw This is a non functional change, simple code refactor.
Diffstat (limited to 'src/lib/ector/software/ector_software_gradient.c')
-rw-r--r--src/lib/ector/software/ector_software_gradient.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/lib/ector/software/ector_software_gradient.c b/src/lib/ector/software/ector_software_gradient.c
index 9d7a9bc431..bbe675ea0b 100644
--- a/src/lib/ector/software/ector_software_gradient.c
+++ b/src/lib/ector/software/ector_software_gradient.c
@@ -9,8 +9,7 @@
9 9
10#include "ector_private.h" 10#include "ector_private.h"
11#include "ector_software_private.h" 11#include "ector_software_private.h"
12#include "ector_drawhelper_private.h" 12#include "draw.h"
13
14 13
15#define GRADIENT_STOPTABLE_SIZE 1024 14#define GRADIENT_STOPTABLE_SIZE 1024
16#define FIXPT_BITS 8 15#define FIXPT_BITS 8
@@ -302,7 +301,7 @@ _generate_gradient_color_table(Efl_Gfx_Gradient_Stop *gradient_stops, int stop_c
302 301
303 curr = gradient_stops; 302 curr = gradient_stops;
304 if (curr->a != 255) alpha = EINA_TRUE; 303 if (curr->a != 255) alpha = EINA_TRUE;
305 current_color = ECTOR_ARGB_JOIN(curr->a, curr->r, curr->g, curr->b); 304 current_color = DRAW_ARGB_JOIN(curr->a, curr->r, curr->g, curr->b);
306 incr = 1.0 / (double)size; 305 incr = 1.0 / (double)size;
307 fpos = 1.5 * incr; 306 fpos = 1.5 * incr;
308 307
@@ -323,7 +322,7 @@ _generate_gradient_color_table(Efl_Gfx_Gradient_Stop *gradient_stops, int stop_c
323 next = (gradient_stops + i + 1); 322 next = (gradient_stops + i + 1);
324 delta = 1/(next->offset - curr->offset); 323 delta = 1/(next->offset - curr->offset);
325 if (next->a != 255) alpha = EINA_TRUE; 324 if (next->a != 255) alpha = EINA_TRUE;
326 next_color = ECTOR_ARGB_JOIN(next->a, next->r, next->g, next->b); 325 next_color = DRAW_ARGB_JOIN(next->a, next->r, next->g, next->b);
327 func = &_ease_linear; 326 func = &_ease_linear;
328 while (fpos < next->offset && pos < size) 327 while (fpos < next->offset && pos < size)
329 { 328 {
@@ -405,7 +404,7 @@ fetch_linear_gradient(uint *buffer, Span_Data *data, int y, int x, int length)
405 end = buffer + length; 404 end = buffer + length;
406 if (inc > (float)(-1e-5) && inc < (float)(1e-5)) 405 if (inc > (float)(-1e-5) && inc < (float)(1e-5))
407 { 406 {
408 _ector_memfill(buffer, length, _gradient_pixel_fixed(g_data, (int)(t * FIXPT_SIZE))); 407 draw_memset32(buffer, _gradient_pixel_fixed(g_data, (int)(t * FIXPT_SIZE)), length);
409 } 408 }
410 else 409 else
411 { 410 {
@@ -456,7 +455,7 @@ fetch_radial_gradient(uint *buffer, Span_Data *data, int y, int x, int length)
456 // avoid division by zero 455 // avoid division by zero
457 if (fabsf(g_data->radial.a) <= 0.00001f) 456 if (fabsf(g_data->radial.a) <= 0.00001f)
458 { 457 {
459 _ector_memfill(buffer, length, 0); 458 draw_memset32(buffer, 0, length);
460 return; 459 return;
461 } 460 }
462 461
@@ -495,17 +494,21 @@ fetch_radial_gradient(uint *buffer, Span_Data *data, int y, int x, int length)
495 _ector_radial_helper(buffer, length, g_data, det, delta_det, delta_delta_det, b, delta_b); 494 _ector_radial_helper(buffer, length, g_data, det, delta_det, delta_delta_det, b, delta_b);
496} 495}
497 496
498 497int
499void 498ector_software_gradient_init(void)
500drawhelper_gradient_init()
501{ 499{
502 _ector_radial_helper = _radial_helper_generic; 500 static int i = 0;
503 _ector_linear_helper = _linear_helper_generic; 501 if (!(i++))
504#ifdef BUILD_SSE3
505 if (eina_cpu_features_get() & EINA_CPU_SSE3)
506 { 502 {
507 _ector_radial_helper = _radial_helper_sse3; 503 _ector_radial_helper = _radial_helper_generic;
508 _ector_linear_helper = _linear_helper_sse3; 504 _ector_linear_helper = _linear_helper_generic;
509 } 505#ifdef BUILD_SSE3
506 if (eina_cpu_features_get() & EINA_CPU_SSE3)
507 {
508 _ector_radial_helper = _radial_helper_sse3;
509 _ector_linear_helper = _linear_helper_sse3;
510 }
510#endif 511#endif
512 }
513 return i;
511} 514}