EAPI void evas_common_rectangle_draw_do(const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h) { Eina_Rectangle area; Cutout_Rect *r; int i; if (!reuse) { evas_common_draw_context_clip_clip(dc, clip->x, clip->y, clip->w, clip->h); rectangle_draw_internal(dst, dc, x, y, w, h); return ; } for (i = 0; i < reuse->active; ++i) { r = reuse->rects + i; EINA_RECTANGLE_SET(&area, r->x, r->y, r->w, r->h); if (!eina_rectangle_intersection(&area, clip)) continue ; evas_common_draw_context_set_clip(dc, area.x, area.y, area.w, area.h); rectangle_draw_internal(dst, dc, x, y, w, h); } }
EAPI void evas_common_draw_context_clip_clip(RGBA_Draw_Context *dc, int x, int y, int w, int h) { if (dc->clip.use) { RECTS_CLIP_TO_RECT(dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h, x, y, w, h); } else evas_common_draw_context_set_clip(dc, x, y, w, h); }
EAPI void evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h) { static Cutout_Rects *rects = NULL; Cutout_Rect *r; int c, cx, cy, cw, ch; int i; /* handle cutouts here! */ if ((dst_region_w <= 0) || (dst_region_h <= 0)) return; if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h, 0, 0, dst->cache_entry.w, dst->cache_entry.h))) return; /* no cutouts - cut right to the chase */ if (!dc->cutout.rects) { scale_rgba_in_to_out_clip_sample_internal(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); return; } /* save out clip info */ c = dc->clip.use; cx = dc->clip.x; cy = dc->clip.y; cw = dc->clip.w; ch = dc->clip.h; evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h); evas_common_draw_context_clip_clip(dc, dst_region_x, dst_region_y, dst_region_w, dst_region_h); /* 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; } 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); scale_rgba_in_to_out_clip_sample_internal(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); } /* restore clip info */ dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; }
void soft8_rectangle_draw(Soft8_Image * dst, RGBA_Draw_Context * dc, int x, int y, int w, int h) { Eina_Rectangle dr; Cutout_Rects *rects; Cutout_Rect *r; struct RGBA_Draw_Context_clip c_bkp; int i; /* handle cutouts here! */ EINA_RECTANGLE_SET(&dr, x, y, w, h); if (_is_empty_rectangle(&dr)) return; if (! (RECTS_INTERSECT (dr.x, dr.y, dr.w, dr.h, 0, 0, dst->cache_entry.w, dst->cache_entry.h))) return; /* no cutouts - cut right to the chase */ if (!dc->cutout.rects) { _soft8_rectangle_draw_int(dst, dc, dr); return; } c_bkp = dc->clip; evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h); 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)) { dc->clip = c_bkp; return; } rects = evas_common_draw_context_apply_cutouts(dc); 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); _soft8_rectangle_draw_int(dst, dc, dr); } evas_common_draw_context_apply_clear_cutouts(rects); dc->clip = c_bkp; }
EAPI void evas_common_scale_rgba_in_to_out_clip_sample_do(const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h) { Eina_Rectangle area; Cutout_Rect *r; int i; if (!reuse) { evas_common_draw_context_clip_clip(dc, clip->x, clip->y, clip->w, clip->h); scale_rgba_in_to_out_clip_sample_internal(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); return; } for (i = 0; i < reuse->active; ++i) { r = reuse->rects + i; EINA_RECTANGLE_SET(&area, r->x, r->y, r->w, r->h); if (!eina_rectangle_intersection(&area, clip)) continue ; evas_common_draw_context_set_clip(dc, area.x, area.y, area.w, area.h); scale_rgba_in_to_out_clip_sample_internal(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); } }
EAPI void evas_common_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h) { Cutout_Rects *rects; Cutout_Rect *r; int c, cx, cy, cw, ch; int i; /* handle cutouts here! */ if ((w <= 0) || (h <= 0)) return; if (!(RECTS_INTERSECT(x, y, w, h, 0, 0, dst->cache_entry.w, dst->cache_entry.h))) return; /* save out clip info */ c = dc->clip.use; cx = dc->clip.x; cy = dc->clip.y; cw = dc->clip.w; ch = dc->clip.h; evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h); /* no cutouts - cut right to the chase */ if (!dc->cutout.rects) { rectangle_draw_internal(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)) { rects = evas_common_draw_context_apply_cutouts(dc); 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); rectangle_draw_internal(dst, dc, x, y, w, h); } evas_common_draw_context_apply_clear_cutouts(rects); } } /* restore clip info */ dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; }