From: Hermet Park Date: Fri, 7 Dec 2018 06:50:57 +0000 (+0900) Subject: ector: code refactoring. X-Git-Tag: submit/tizen/20181218.080725~92 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F75%2F194775%2F1;p=platform%2Fupstream%2Fefl.git ector: code refactoring. make code clean and neat. no logical changes. Change-Id: Ib6b324b24a2e97c6628a5ed6abf14062815de8ff --- diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c index 4ffad58..396e472 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 @@ #include "ector_private.h" #include "ector_software_private.h" +#define MY_CLASS ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS + typedef struct _Ector_Renderer_Software_Shape_Data Ector_Renderer_Software_Shape_Data; typedef struct _Ector_Software_Shape_Task Ector_Software_Shape_Task; @@ -743,7 +745,7 @@ _ector_renderer_software_shape_efl_gfx_path_path_set(Eo *obj, pd->shape_data = NULL; pd->outline_data = NULL; - efl_gfx_path_set(efl_super(obj, ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS), op, points); + efl_gfx_path_set(efl_super(obj, MY_CLASS), op, points); } @@ -767,7 +769,7 @@ _ector_renderer_software_shape_path_changed(void *data, const Efl_Event *event E static Eo * _ector_renderer_software_shape_efl_object_constructor(Eo *obj, Ector_Renderer_Software_Shape_Data *pd) { - obj = efl_constructor(efl_super(obj, ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS)); + obj = efl_constructor(efl_super(obj, MY_CLASS)); if (!obj) return NULL; pd->task = NULL; @@ -799,17 +801,16 @@ _ector_renderer_software_shape_efl_object_destructor(Eo *obj, Ector_Renderer_Sof efl_data_xunref(obj, pd->shape, obj); efl_data_xunref(obj, pd->public_shape, obj); - efl_destructor(efl_super(obj, ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS)); + efl_destructor(efl_super(obj, MY_CLASS)); } - unsigned int _ector_renderer_software_shape_ector_renderer_crc_get(const Eo *obj, - Ector_Renderer_Software_Shape_Data *pd) + Ector_Renderer_Software_Shape_Data *pd) { unsigned int crc; - crc = ector_renderer_crc_get(efl_super(obj, ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS)); + crc = ector_renderer_crc_get(efl_super(obj, MY_CLASS)); crc = eina_crc((void*) &pd->shape->stroke.marker, 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 e1a3fc2..34ea003 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 typedef struct _Shape_Rle_Data { Eina_Rectangle bbox; + //ALLOC == SIZE? unsigned short alloc; unsigned short size; SW_FT_Span *spans;// array of Scanlines. @@ -63,11 +64,9 @@ typedef struct _Clip_Data Eina_Array *clips; //Eina_Rectangle Shape_Rle_Data *path; unsigned int enabled : 1; - unsigned int has_rect_clip : 1; - unsigned int has_path_clip : 1; + unsigned int type : 1; //0: rect, 1: path } Clip_Data; - typedef enum _Span_Data_Type { None, Solid, @@ -100,6 +99,7 @@ typedef struct _Span_Data typedef struct _Software_Rasterizer { Span_Data fill_data; + //Necessary?: Eina_Matrix3 *transform; Eina_Rectangle system_clip; } Software_Rasterizer; diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c index 5838475..d9b3351 100644 --- a/src/lib/ector/software/ector_software_rasterizer.c +++ b/src/lib/ector/software/ector_software_rasterizer.c @@ -306,8 +306,8 @@ _span_fill_clipRect(int span_count, const SW_FT_Span *spans, void *user_data) Eina_Rectangle *rect; Eina_Rectangle tmp_rect; - clip_count = eina_array_count(clip.clips); + for (i = 0; i < clip_count; i++) { rect = (Eina_Rectangle *)eina_array_data_get(clip.clips, i); @@ -378,23 +378,16 @@ _adjust_span_fill_methods(Span_Data *spdata) break; } - // setup clipping - if (!spdata->unclipped_blend) - { - spdata->blend = 0; - } - else if (!spdata->clip.enabled) - { - spdata->blend = spdata->unclipped_blend; - } - else if (spdata->clip.has_rect_clip) + // Clipping Function + if (spdata->clip.enabled) { - spdata->blend = &_span_fill_clipRect; + if (spdata->clip.type == 0) + spdata->blend = &_span_fill_clipRect; + else + spdata->blend = &_span_fill_clipPath; } else - { - spdata->blend = &_span_fill_clipPath; - } + spdata->blend = spdata->unclipped_blend; } void ector_software_thread_init(Ector_Software_Thread *thread) @@ -561,7 +554,8 @@ ector_software_rasterizer_generate_stroke_rle_data(Ector_Software_Thread *thread return rle_data; } -void ector_software_rasterizer_destroy_rle_data(Shape_Rle_Data *rle) +void +ector_software_rasterizer_destroy_rle_data(Shape_Rle_Data *rle) { if (rle) { @@ -580,35 +574,48 @@ void _setup_span_fill_matrix(Software_Rasterizer *rasterizer) eina_matrix3_identity(&rasterizer->fill_data.inv); } -void ector_software_rasterizer_transform_set(Software_Rasterizer *rasterizer, Eina_Matrix3 *t) +void +ector_software_rasterizer_transform_set(Software_Rasterizer *rasterizer, Eina_Matrix3 *t) { rasterizer->transform = t; } -void ector_software_rasterizer_clip_rect_set(Software_Rasterizer *rasterizer, Eina_Array *clips) +void +ector_software_rasterizer_clip_rect_set(Software_Rasterizer *rasterizer, Eina_Array *clips) { if (clips) { rasterizer->fill_data.clip.clips = clips; - rasterizer->fill_data.clip.has_rect_clip = EINA_TRUE; + rasterizer->fill_data.clip.type = 0; rasterizer->fill_data.clip.enabled = EINA_TRUE; } else { rasterizer->fill_data.clip.clips = NULL; - rasterizer->fill_data.clip.has_rect_clip = EINA_FALSE; + rasterizer->fill_data.clip.type = 0; rasterizer->fill_data.clip.enabled = EINA_FALSE; } } -void ector_software_rasterizer_clip_shape_set(Software_Rasterizer *rasterizer, Shape_Rle_Data *clip) +void +ector_software_rasterizer_clip_shape_set(Software_Rasterizer *rasterizer, Shape_Rle_Data *clip) { - rasterizer->fill_data.clip.path = clip; - rasterizer->fill_data.clip.has_path_clip = EINA_TRUE; - rasterizer->fill_data.clip.enabled = EINA_TRUE; + if (clip) + { + rasterizer->fill_data.clip.path = clip; + rasterizer->fill_data.clip.type = 1; + rasterizer->fill_data.clip.enabled = EINA_TRUE; + } + else + { + rasterizer->fill_data.clip.path = NULL; + rasterizer->fill_data.clip.type = 0; + rasterizer->fill_data.clip.enabled = EINA_FALSE; + } } -void ector_software_rasterizer_color_set(Software_Rasterizer *rasterizer, int r, int g, int b, int a) +void +ector_software_rasterizer_color_set(Software_Rasterizer *rasterizer, int r, int g, int b, int a) { rasterizer->fill_data.color = DRAW_ARGB_JOIN(a, r, g, b); rasterizer->fill_data.type = Solid; @@ -621,8 +628,9 @@ void ector_software_rasterizer_linear_gradient_set(Software_Rasterizer *rasteriz rasterizer->fill_data.type = LinearGradient; } -void ector_software_rasterizer_radial_gradient_set(Software_Rasterizer *rasterizer, - Ector_Renderer_Software_Gradient_Data *radial) +void +ector_software_rasterizer_radial_gradient_set(Software_Rasterizer *rasterizer, + Ector_Renderer_Software_Gradient_Data *radial) { rasterizer->fill_data.gradient = radial; rasterizer->fill_data.type = RadialGradient;