aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsubhransu mohanty <sub.mohanty@samsung.com>2017-11-03 14:20:42 +0900
committersubhransu mohanty <sub.mohanty@samsung.com>2017-11-06 17:52:27 +0900
commitc2ed0e24c0c31526c7d751d6fd81d51b11208457 (patch)
treecef1a8b58b2f851053e3094e9e1a2e7f6e63a709
parentector: added clip_push and clip_pop method to ector_surface class (diff)
downloadefl-devs/subhransu/clippath.tar.gz
ector/software: implement clipping in ector surface.devs/subhransu/clippath
-rw-r--r--src/lib/ector/software/ector_software_private.h9
-rw-r--r--src/lib/ector/software/ector_software_surface.c25
2 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/ector/software/ector_software_private.h b/src/lib/ector/software/ector_software_private.h
index 270a14d96c..cd30a73f3a 100644
--- a/src/lib/ector/software/ector_software_private.h
+++ b/src/lib/ector/software/ector_software_private.h
@@ -8,6 +8,7 @@
typedef struct _Ector_Software_Surface_Data Ector_Software_Surface_Data;
typedef struct _Ector_Software_Thread Ector_Software_Thread;
+typedef struct _Ector_Software_Clip_info Ector_Software_Clip_info;
struct _Ector_Software_Thread
{
@@ -102,9 +103,17 @@ typedef struct _Software_Rasterizer
Eina_Rectangle system_clip;
} Software_Rasterizer;
+struct
+_Ector_Software_Clip_info
+{
+ const Ector_Renderer *clipper;
+ Shape_Rle_Data *clip_data;
+};
+
struct _Ector_Software_Surface_Data
{
Software_Rasterizer *rasterizer;
+ Eina_Array *clip_info; // Ector_Software_Clip_info stack
int x;
int y;
};
diff --git a/src/lib/ector/software/ector_software_surface.c b/src/lib/ector/software/ector_software_surface.c
index bff392ddf5..7a9a554650 100644
--- a/src/lib/ector/software/ector_software_surface.c
+++ b/src/lib/ector/software/ector_software_surface.c
@@ -248,7 +248,17 @@ _ector_software_surface_ector_surface_clip_push(Eo *obj EINA_UNUSED,
Ector_Software_Surface_Data *pd EINA_UNUSED,
const Ector_Renderer *clip EINA_UNUSED)
{
+ Ector_Software_Clip_info *clip_info;
+ if (!clip) return;
+ if (!pd->clip_info)
+ pd->clip_info = eina_array_new(8);
+
+ clip_info = malloc(sizeof(clip_info));
+ clip_info->clipper = clip;
+ // @TODO generate the RLE data and intersect with the previous value and
+ // store it.
+ eina_array_push(pd->clip_info, clip_info);
}
@@ -257,7 +267,22 @@ _ector_software_surface_ector_surface_clip_pop(Eo *obj EINA_UNUSED,
Ector_Software_Surface_Data *pd EINA_UNUSED,
const Ector_Renderer *clip EINA_UNUSED)
{
+ Ector_Software_Clip_info *clip_info;
+
+ if (!pd->clip_info)
+ {
+ ERR("ector_surface_clip_pop is not matched by ector_surface_clip_push");
+ return;
+ }
+
+ clip_info = eina_array_pop(pd->clip_info);
+
+ if(clip_info->clipper != clip)
+ ERR("Incorrect handling of clip object = %p", clip);
+ if (clip_info->clip_data)
+ ector_software_rasterizer_destroy_rle_data(clip_info->clip_data);
+ free(clip_info);
}
#include "ector_software_surface.eo.c"