summaryrefslogtreecommitdiff
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
parentc58da68cf3513dd844093ff4bb032d72e6d1ed27 (diff)
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 @@
8 8
9typedef struct _Ector_Software_Surface_Data Ector_Software_Surface_Data; 9typedef struct _Ector_Software_Surface_Data Ector_Software_Surface_Data;
10typedef struct _Ector_Software_Thread Ector_Software_Thread; 10typedef struct _Ector_Software_Thread Ector_Software_Thread;
11typedef struct _Ector_Software_Clip_info Ector_Software_Clip_info;
11 12
12struct _Ector_Software_Thread 13struct _Ector_Software_Thread
13{ 14{
@@ -102,9 +103,17 @@ typedef struct _Software_Rasterizer
102 Eina_Rectangle system_clip; 103 Eina_Rectangle system_clip;
103} Software_Rasterizer; 104} Software_Rasterizer;
104 105
106struct
107_Ector_Software_Clip_info
108{
109 const Ector_Renderer *clipper;
110 Shape_Rle_Data *clip_data;
111};
112
105struct _Ector_Software_Surface_Data 113struct _Ector_Software_Surface_Data
106{ 114{
107 Software_Rasterizer *rasterizer; 115 Software_Rasterizer *rasterizer;
116 Eina_Array *clip_info; // Ector_Software_Clip_info stack
108 int x; 117 int x;
109 int y; 118 int y;
110}; 119};
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,
248 Ector_Software_Surface_Data *pd EINA_UNUSED, 248 Ector_Software_Surface_Data *pd EINA_UNUSED,
249 const Ector_Renderer *clip EINA_UNUSED) 249 const Ector_Renderer *clip EINA_UNUSED)
250{ 250{
251 Ector_Software_Clip_info *clip_info;
252 if (!clip) return;
251 253
254 if (!pd->clip_info)
255 pd->clip_info = eina_array_new(8);
256
257 clip_info = malloc(sizeof(clip_info));
258 clip_info->clipper = clip;
259 // @TODO generate the RLE data and intersect with the previous value and
260 // store it.
261 eina_array_push(pd->clip_info, clip_info);
252} 262}
253 263
254 264
@@ -257,7 +267,22 @@ _ector_software_surface_ector_surface_clip_pop(Eo *obj EINA_UNUSED,
257 Ector_Software_Surface_Data *pd EINA_UNUSED, 267 Ector_Software_Surface_Data *pd EINA_UNUSED,
258 const Ector_Renderer *clip EINA_UNUSED) 268 const Ector_Renderer *clip EINA_UNUSED)
259{ 269{
270 Ector_Software_Clip_info *clip_info;
271
272 if (!pd->clip_info)
273 {
274 ERR("ector_surface_clip_pop is not matched by ector_surface_clip_push");
275 return;
276 }
277
278 clip_info = eina_array_pop(pd->clip_info);
279
280 if(clip_info->clipper != clip)
281 ERR("Incorrect handling of clip object = %p", clip);
260 282
283 if (clip_info->clip_data)
284 ector_software_rasterizer_destroy_rle_data(clip_info->clip_data);
285 free(clip_info);
261} 286}
262 287
263#include "ector_software_surface.eo.c" 288#include "ector_software_surface.eo.c"