summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/gl_common/evas_gl_polygon.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-04-01 11:01:48 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-04-01 11:02:18 +0900
commit1864362aaf97ac2fd5118a842c1df694054c0cdb (patch)
treecba6dee0f92fe9ee7d31904974bbf8b2c285753f /src/modules/evas/engines/gl_common/evas_gl_polygon.c
parente38f5cafd579d714f3793fe7b4ef75747e62233f (diff)
Evas masking: Implement polygon masking (GL)
Diffstat (limited to 'src/modules/evas/engines/gl_common/evas_gl_polygon.c')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_polygon.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_polygon.c b/src/modules/evas/engines/gl_common/evas_gl_polygon.c
index df87cb7..4552d66 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_polygon.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_polygon.c
@@ -131,6 +131,10 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int
131 Cutout_Rect *r; 131 Cutout_Rect *r;
132 int c, cx, cy, cw, ch, cr, cg, cb, ca, i; 132 int c, cx, cy, cw, ch, cr, cg, cb, ca, i;
133 int x = 0, y = 0, w = 0, h = 0; 133 int x = 0, y = 0, w = 0, h = 0;
134 Evas_GL_Texture *mtex = NULL;
135 Eina_Bool mask_smooth = EINA_FALSE;
136 int mx = 0, my = 0, mw = 0, mh = 0;
137 Evas_GL_Image *mask;
134 138
135 Eina_List *l; 139 Eina_List *l;
136 int n, k, num_active_edges, yy0, yy1, *sorted_index, j; 140 int n, k, num_active_edges, yy0, yy1, *sorted_index, j;
@@ -139,8 +143,6 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int
139 Evas_GL_Polygon_Point *pt; 143 Evas_GL_Polygon_Point *pt;
140 Eina_Inlist *spans; 144 Eina_Inlist *spans;
141 145
142 // TODO: Implement masking support (not very important right now)
143
144 /* save out clip info */ 146 /* save out clip info */
145 c = gc->dc->clip.use; cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h; 147 c = gc->dc->clip.use; cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h;
146 148
@@ -150,6 +152,23 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int
150 cg = (gc->dc->col.col >> 8 ) & 0xff; 152 cg = (gc->dc->col.col >> 8 ) & 0xff;
151 cb = (gc->dc->col.col ) & 0xff; 153 cb = (gc->dc->col.col ) & 0xff;
152 154
155 mask = gc->dc->clip.mask;
156 if (mask)
157 {
158 evas_gl_common_image_update(gc, mask);
159 mtex = mask->tex;
160 if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
161 {
162 // canvas coords
163 mx = gc->dc->clip.mask_x;
164 my = gc->dc->clip.mask_y;
165 mw = mask->w;
166 mh = mask->h;
167 mask_smooth = mask->scaled.smooth;
168 }
169 else mtex = NULL;
170 }
171
153 n = eina_list_count(poly->points); 172 n = eina_list_count(poly->points);
154 if (n < 3) return; 173 if (n < 3) return;
155 edges = malloc(sizeof(RGBA_Edge) * n); 174 edges = malloc(sizeof(RGBA_Edge) * n);
@@ -272,7 +291,7 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int
272 h = 1; 291 h = 1;
273 evas_gl_common_context_rectangle_push(gc, x, y, w, h, 292 evas_gl_common_context_rectangle_push(gc, x, y, w, h,
274 cr, cg, cb, ca, 293 cr, cg, cb, ca,
275 NULL, 0, 0, 0, 0, EINA_FALSE); 294 mtex, mx, my, mw, mh, mask_smooth);
276 } 295 }
277 } 296 }
278 else 297 else
@@ -296,7 +315,7 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int
296 if ((w > 0) && (h > 0)) 315 if ((w > 0) && (h > 0))
297 evas_gl_common_context_rectangle_push(gc, x, y, w, h, 316 evas_gl_common_context_rectangle_push(gc, x, y, w, h,
298 cr, cg, cb, ca, 317 cr, cg, cb, ca,
299 NULL, 0, 0, 0, 0, EINA_FALSE); 318 mtex, mx, my, mw, mh, mask_smooth);
300 } 319 }
301 } 320 }
302 } 321 }