summaryrefslogtreecommitdiff
path: root/src/lib/ector
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2018-12-07 15:50:57 +0900
committerHermet Park <hermetpark@gmail.com>2018-12-07 15:50:57 +0900
commitcfc66dd0bd8467e41b0d3584fc5e33f9497412b2 (patch)
tree461b6fae4df86c982c4e55dd1e509ae38fc065d7 /src/lib/ector
parentca3ddc21e432ebbd36b595732fc269b98395c9c6 (diff)
ector: code refactoring.
make code clean and neat. no logical changes.
Diffstat (limited to 'src/lib/ector')
-rw-r--r--src/lib/ector/software/ector_renderer_software_shape.c13
-rw-r--r--src/lib/ector/software/ector_software_private.h6
-rw-r--r--src/lib/ector/software/ector_software_rasterizer.c62
3 files changed, 45 insertions, 36 deletions
diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c
index be96c82..6749d5f 100644
--- a/src/lib/ector/software/ector_renderer_software_shape.c
+++ b/src/lib/ector/software/ector_renderer_software_shape.c
@@ -12,6 +12,8 @@
12#include "ector_private.h" 12#include "ector_private.h"
13#include "ector_software_private.h" 13#include "ector_software_private.h"
14 14
15#define MY_CLASS ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS
16
15typedef struct _Ector_Renderer_Software_Shape_Data Ector_Renderer_Software_Shape_Data; 17typedef struct _Ector_Renderer_Software_Shape_Data Ector_Renderer_Software_Shape_Data;
16typedef struct _Ector_Software_Shape_Task Ector_Software_Shape_Task; 18typedef struct _Ector_Software_Shape_Task Ector_Software_Shape_Task;
17 19
@@ -730,7 +732,7 @@ _ector_renderer_software_shape_efl_gfx_path_path_set(Eo *obj,
730 pd->shape_data = NULL; 732 pd->shape_data = NULL;
731 pd->outline_data = NULL; 733 pd->outline_data = NULL;
732 734
733 efl_gfx_path_set(efl_super(obj, ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS), op, points); 735 efl_gfx_path_set(efl_super(obj, MY_CLASS), op, points);
734} 736}
735 737
736 738
@@ -754,7 +756,7 @@ _ector_renderer_software_shape_path_changed(void *data, const Efl_Event *event E
754static Eo * 756static Eo *
755_ector_renderer_software_shape_efl_object_constructor(Eo *obj, Ector_Renderer_Software_Shape_Data *pd) 757_ector_renderer_software_shape_efl_object_constructor(Eo *obj, Ector_Renderer_Software_Shape_Data *pd)
756{ 758{
757 obj = efl_constructor(efl_super(obj, ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS)); 759 obj = efl_constructor(efl_super(obj, MY_CLASS));
758 if (!obj) return NULL; 760 if (!obj) return NULL;
759 761
760 pd->task = NULL; 762 pd->task = NULL;
@@ -786,17 +788,16 @@ _ector_renderer_software_shape_efl_object_destructor(Eo *obj, Ector_Renderer_Sof
786 efl_data_xunref(obj, pd->shape, obj); 788 efl_data_xunref(obj, pd->shape, obj);
787 efl_data_xunref(obj, pd->public_shape, obj); 789 efl_data_xunref(obj, pd->public_shape, obj);
788 790
789 efl_destructor(efl_super(obj, ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS)); 791 efl_destructor(efl_super(obj, MY_CLASS));
790} 792}
791 793
792
793unsigned int 794unsigned int
794_ector_renderer_software_shape_ector_renderer_crc_get(const Eo *obj, 795_ector_renderer_software_shape_ector_renderer_crc_get(const Eo *obj,
795 Ector_Renderer_Software_Shape_Data *pd) 796 Ector_Renderer_Software_Shape_Data *pd)
796{ 797{
797 unsigned int crc; 798 unsigned int crc;
798 799
799 crc = ector_renderer_crc_get(efl_super(obj, ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS)); 800 crc = ector_renderer_crc_get(efl_super(obj, MY_CLASS));
800 801
801 crc = eina_crc((void*) &pd->shape->stroke.marker, 802 crc = eina_crc((void*) &pd->shape->stroke.marker,
802 sizeof (pd->shape->stroke.marker), 803 sizeof (pd->shape->stroke.marker),
diff --git a/src/lib/ector/software/ector_software_private.h b/src/lib/ector/software/ector_software_private.h
index 270a14d..dad1f99 100644
--- a/src/lib/ector/software/ector_software_private.h
+++ b/src/lib/ector/software/ector_software_private.h
@@ -53,6 +53,7 @@ typedef struct _Ector_Renderer_Software_Gradient_Data
53typedef struct _Shape_Rle_Data 53typedef struct _Shape_Rle_Data
54{ 54{
55 Eina_Rectangle bbox; 55 Eina_Rectangle bbox;
56 //ALLOC == SIZE?
56 unsigned short alloc; 57 unsigned short alloc;
57 unsigned short size; 58 unsigned short size;
58 SW_FT_Span *spans;// array of Scanlines. 59 SW_FT_Span *spans;// array of Scanlines.
@@ -63,11 +64,9 @@ typedef struct _Clip_Data
63 Eina_Array *clips; //Eina_Rectangle 64 Eina_Array *clips; //Eina_Rectangle
64 Shape_Rle_Data *path; 65 Shape_Rle_Data *path;
65 unsigned int enabled : 1; 66 unsigned int enabled : 1;
66 unsigned int has_rect_clip : 1; 67 unsigned int type : 1; //0: rect, 1: path
67 unsigned int has_path_clip : 1;
68} Clip_Data; 68} Clip_Data;
69 69
70
71typedef enum _Span_Data_Type { 70typedef enum _Span_Data_Type {
72 None, 71 None,
73 Solid, 72 Solid,
@@ -98,6 +97,7 @@ typedef struct _Span_Data
98typedef struct _Software_Rasterizer 97typedef struct _Software_Rasterizer
99{ 98{
100 Span_Data fill_data; 99 Span_Data fill_data;
100 //Necessary?:
101 Eina_Matrix3 *transform; 101 Eina_Matrix3 *transform;
102 Eina_Rectangle system_clip; 102 Eina_Rectangle system_clip;
103} Software_Rasterizer; 103} Software_Rasterizer;
diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c
index 0671449..25169be 100644
--- a/src/lib/ector/software/ector_software_rasterizer.c
+++ b/src/lib/ector/software/ector_software_rasterizer.c
@@ -220,8 +220,8 @@ _span_fill_clipRect(int span_count, const SW_FT_Span *spans, void *user_data)
220 Eina_Rectangle *rect; 220 Eina_Rectangle *rect;
221 Eina_Rectangle tmp_rect; 221 Eina_Rectangle tmp_rect;
222 222
223
224 clip_count = eina_array_count(clip.clips); 223 clip_count = eina_array_count(clip.clips);
224
225 for (i = 0; i < clip_count; i++) 225 for (i = 0; i < clip_count; i++)
226 { 226 {
227 rect = (Eina_Rectangle *)eina_array_data_get(clip.clips, i); 227 rect = (Eina_Rectangle *)eina_array_data_get(clip.clips, i);
@@ -281,23 +281,16 @@ _adjust_span_fill_methods(Span_Data *spdata)
281 break; 281 break;
282 } 282 }
283 283
284 // setup clipping 284 // Clipping Function
285 if (!spdata->unclipped_blend) 285 if (spdata->clip.enabled)
286 {
287 spdata->blend = 0;
288 }
289 else if (!spdata->clip.enabled)
290 { 286 {
291 spdata->blend = spdata->unclipped_blend; 287 if (spdata->clip.type == 0)
292 } 288 spdata->blend = &_span_fill_clipRect;
293 else if (spdata->clip.has_rect_clip) 289 else
294 { 290 spdata->blend = &_span_fill_clipPath;
295 spdata->blend = &_span_fill_clipRect;
296 } 291 }
297 else 292 else
298 { 293 spdata->blend = spdata->unclipped_blend;
299 spdata->blend = &_span_fill_clipPath;
300 }
301} 294}
302 295
303void ector_software_thread_init(Ector_Software_Thread *thread) 296void ector_software_thread_init(Ector_Software_Thread *thread)
@@ -464,7 +457,8 @@ ector_software_rasterizer_generate_stroke_rle_data(Ector_Software_Thread *thread
464 return rle_data; 457 return rle_data;
465} 458}
466 459
467void ector_software_rasterizer_destroy_rle_data(Shape_Rle_Data *rle) 460void
461ector_software_rasterizer_destroy_rle_data(Shape_Rle_Data *rle)
468{ 462{
469 if (rle) 463 if (rle)
470 { 464 {
@@ -483,35 +477,48 @@ void _setup_span_fill_matrix(Software_Rasterizer *rasterizer)
483 eina_matrix3_identity(&rasterizer->fill_data.inv); 477 eina_matrix3_identity(&rasterizer->fill_data.inv);
484} 478}
485 479
486void ector_software_rasterizer_transform_set(Software_Rasterizer *rasterizer, Eina_Matrix3 *t) 480void
481ector_software_rasterizer_transform_set(Software_Rasterizer *rasterizer, Eina_Matrix3 *t)
487{ 482{
488 rasterizer->transform = t; 483 rasterizer->transform = t;
489} 484}
490 485
491void ector_software_rasterizer_clip_rect_set(Software_Rasterizer *rasterizer, Eina_Array *clips) 486void
487ector_software_rasterizer_clip_rect_set(Software_Rasterizer *rasterizer, Eina_Array *clips)
492{ 488{
493 if (clips) 489 if (clips)
494 { 490 {
495 rasterizer->fill_data.clip.clips = clips; 491 rasterizer->fill_data.clip.clips = clips;
496 rasterizer->fill_data.clip.has_rect_clip = EINA_TRUE; 492 rasterizer->fill_data.clip.type = 0;
497 rasterizer->fill_data.clip.enabled = EINA_TRUE; 493 rasterizer->fill_data.clip.enabled = EINA_TRUE;
498 } 494 }
499 else 495 else
500 { 496 {
501 rasterizer->fill_data.clip.clips = NULL; 497 rasterizer->fill_data.clip.clips = NULL;
502 rasterizer->fill_data.clip.has_rect_clip = EINA_FALSE; 498 rasterizer->fill_data.clip.type = 0;
503 rasterizer->fill_data.clip.enabled = EINA_FALSE; 499 rasterizer->fill_data.clip.enabled = EINA_FALSE;
504 } 500 }
505} 501}
506 502
507void ector_software_rasterizer_clip_shape_set(Software_Rasterizer *rasterizer, Shape_Rle_Data *clip) 503void
504ector_software_rasterizer_clip_shape_set(Software_Rasterizer *rasterizer, Shape_Rle_Data *clip)
508{ 505{
509 rasterizer->fill_data.clip.path = clip; 506 if (clip)
510 rasterizer->fill_data.clip.has_path_clip = EINA_TRUE; 507 {
511 rasterizer->fill_data.clip.enabled = EINA_TRUE; 508 rasterizer->fill_data.clip.path = clip;
509 rasterizer->fill_data.clip.type = 1;
510 rasterizer->fill_data.clip.enabled = EINA_TRUE;
511 }
512 else
513 {
514 rasterizer->fill_data.clip.path = NULL;
515 rasterizer->fill_data.clip.type = 0;
516 rasterizer->fill_data.clip.enabled = EINA_FALSE;
517 }
512} 518}
513 519
514void ector_software_rasterizer_color_set(Software_Rasterizer *rasterizer, int r, int g, int b, int a) 520void
521ector_software_rasterizer_color_set(Software_Rasterizer *rasterizer, int r, int g, int b, int a)
515{ 522{
516 rasterizer->fill_data.color = DRAW_ARGB_JOIN(a, r, g, b); 523 rasterizer->fill_data.color = DRAW_ARGB_JOIN(a, r, g, b);
517 rasterizer->fill_data.type = Solid; 524 rasterizer->fill_data.type = Solid;
@@ -524,8 +531,9 @@ void ector_software_rasterizer_linear_gradient_set(Software_Rasterizer *rasteriz
524 rasterizer->fill_data.type = LinearGradient; 531 rasterizer->fill_data.type = LinearGradient;
525} 532}
526 533
527void ector_software_rasterizer_radial_gradient_set(Software_Rasterizer *rasterizer, 534void
528 Ector_Renderer_Software_Gradient_Data *radial) 535ector_software_rasterizer_radial_gradient_set(Software_Rasterizer *rasterizer,
536 Ector_Renderer_Software_Gradient_Data *radial)
529{ 537{
530 rasterizer->fill_data.gradient = radial; 538 rasterizer->fill_data.gradient = radial;
531 rasterizer->fill_data.type = RadialGradient; 539 rasterizer->fill_data.type = RadialGradient;