EAPI Eina_Bool
evas_common_font_draw_cb(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs, Evas_Common_Font_Draw_Cb cb)
{
+#ifdef HAVE_THREAD_SPECIFIER
+ static __thread int rects_used = 0;
static __thread Cutout_Rects *rects = NULL;
+#else
+ Cutout_Rects *rects = NULL;
+#endif
int ext_x, ext_y, ext_w, ext_h;
int im_w, im_h;
RGBA_Gfx_Func func;
func, r->x, r->y, r->w, r->h,
im_w, im_h);
}
+#ifdef HAVE_THREAD_SPECIFIER
+ rects_used++;
+ if (rects_used >= 4096)
+ {
+ evas_common_draw_context_cutouts_free(rects);
+ rects = NULL;
+ }
+#else
+ evas_common_draw_context_cutouts_free(rects);
+#endif
}
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
int smooth, int level,
Evas_Common_Map_RGBA_Cb cb)
{
+#ifdef HAVE_THREAD_SPECIFIER
+ static __thread int rects_used = 0;
static __thread Cutout_Rects *rects = NULL;
+#else
+ Cutout_Rects *rects = NULL;
+#endif
Cutout_Rect *r;
int c, cx, cy, cw, ch;
int i;
evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
cb(src, dst, dc, p, smooth, level);
}
+#ifdef HAVE_THREAD_SPECIFIER
+ rects_used++;
+ if (rects_used >= 4096)
+ {
+ evas_common_draw_context_cutouts_free(rects);
+ rects = NULL;
+ }
+#else
+ evas_common_draw_context_cutouts_free(rects);
+#endif
/* restore clip info */
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
}
EAPI Eina_Bool
evas_common_map_thread_rgba_cb(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Map *map, int smooth, int level, int offset, Evas_Common_Map_Thread_RGBA_Cb cb)
{
+#ifdef HAVE_THREAD_SPECIFIER
+ static __thread int rects_used = 0;
static __thread Cutout_Rects *rects = NULL;
+#else
+ Cutout_Rects *rects = NULL;
+#endif
Cutout_Rect *r;
int c, cx, cy, cw, ch;
int i;
evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
ret |= cb(src, dst, dc, map, smooth, level, offset);
}
-
+#ifdef HAVE_THREAD_SPECIFIER
+ rects_used++;
+ if (rects_used >= 4096)
+ {
+ evas_common_draw_context_cutouts_free(rects);
+ rects = NULL;
+ }
+#else
+ evas_common_draw_context_cutouts_free(rects);
+#endif
/* restore clip info */
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
EAPI void
evas_common_rectangle_draw_cb(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h, Evas_Common_Rectangle_Draw_Cb cb)
{
+#ifdef HAVE_THREAD_SPECIFIER
+ static __thread int rects_used = 0;
static __thread Cutout_Rects *rects = NULL;
+#else
+ Cutout_Rects *rects = NULL;
+#endif
Cutout_Rect *r;
int c, cx, cy, cw, ch;
int i;
/* no cutouts - cut right to the chase */
if (!dc->cutout.rects)
{
- cb(dst, dc, x, y, w, h);
+ cb(dst, dc, x, y, w, h);
}
else
{
- evas_common_draw_context_clip_clip(dc, x, y, w, h);
- /* our clip is 0 size.. abort */
- if ((dc->clip.w > 0) && (dc->clip.h > 0))
- {
+ evas_common_draw_context_clip_clip(dc, x, y, w, h);
+ /* our clip is 0 size.. abort */
+ if ((dc->clip.w > 0) && (dc->clip.h > 0))
+ {
rects = evas_common_draw_context_apply_cutouts(dc, rects);
- for (i = 0; i < rects->active; ++i)
- {
- r = rects->rects + i;
- evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
- cb(dst, dc, x, y, w, h);
- }
- }
+ for (i = 0; i < rects->active; ++i)
+ {
+ r = rects->rects + i;
+ evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
+ cb(dst, dc, x, y, w, h);
+ }
+#ifdef HAVE_THREAD_SPECIFIER
+ rects_used++;
+ if (rects_used >= 4096)
+ {
+ evas_common_draw_context_cutouts_free(rects);
+ rects = NULL;
+ }
+#else
+ evas_common_draw_context_cutouts_free(rects);
+#endif
+ }
}
/* restore clip info */
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
int dst_region_w, int dst_region_h,
Evas_Common_Scale_In_To_Out_Clip_Cb cb)
{
+#ifdef HAVE_THREAD_SPECIFIER
+ static __thread int rects_used = 0;
static __thread Cutout_Rects *rects = NULL;
+#else
+ Cutout_Rects *rects = NULL;
+#endif
Cutout_Rect *r;
int c, cx, cy, cw, ch;
int i;
/* our clip is 0 size.. abort */
if ((dc->clip.w <= 0) || (dc->clip.h <= 0))
{
- dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
- return EINA_FALSE;
+ dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
+ return EINA_FALSE;
}
rects = evas_common_draw_context_apply_cutouts(dc, rects);
for (i = 0; i < rects->active; ++i)
{
- r = rects->rects + i;
- evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
+ r = rects->rects + i;
+ evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
ret |= cb(src, dst, dc,
src_region_x, src_region_y, src_region_w, src_region_h,
dst_region_x, dst_region_y, dst_region_w, dst_region_h);
}
-
+#ifdef HAVE_THREAD_SPECIFIER
+ rects_used++;
+ if (rects_used >= 4096)
+ {
+ evas_common_draw_context_cutouts_free(rects);
+ rects = NULL;
+ }
+#else
+ evas_common_draw_context_cutouts_free(rects);
+#endif
/* restore clip info */
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;