aboutsummaryrefslogtreecommitdiffstats
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
parentevas vg: code refactoring. (diff)
downloadefl-cfc66dd0bd8467e41b0d3584fc5e33f9497412b2.tar.gz
ector: code refactoring.
make code clean and neat. no logical changes.
-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 be96c827ee..6749d5fcb9 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;
@@ -730,7 +732,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);
}
@@ -754,7 +756,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;
@@ -786,17 +788,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 270a14d96c..dad1f9948c 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,
@@ -98,6 +97,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 0671449891..25169be790 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)
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);
@@ -281,23 +281,16 @@ _adjust_span_fill_methods(Span_Data *spdata)
break;
}
- // setup clipping
- if (!spdata->unclipped_blend)
- {
- spdata->blend = 0;
- }
- else if (!spdata->clip.enabled)
+ // Clipping Function
+ if (spdata->clip.enabled)
{
- spdata->blend = spdata->unclipped_blend;
- }
- else if (spdata->clip.has_rect_clip)
- {
- 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)
@@ -464,7 +457,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)
{
@@ -483,35 +477,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;
@@ -524,8 +531,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;