evas/rectangle: Refactor common code for rectangle drawing

This patch refactors common code for rectangle draws - so that it can be
used by other engines and *threaded* X11.

Signed-off-by: Paulo Alcantara <pcacjr@profusion.mobi>

Patch by: Paulo Alcantara <pcacjr@profusion.mobi>



SVN revision: 79785
This commit is contained in:
Paulo Alcantara 2012-11-28 19:17:00 +00:00 committed by Gustavo Sverzut Barbieri
parent 34fa1349ba
commit 7dd926fbae
2 changed files with 11 additions and 4 deletions

View File

@ -1,9 +1,10 @@
#ifndef _EVAS_RECTANGLE_H
#define _EVAS_RECTANGLE_H
typedef void (*Evas_Common_Rectangle_Draw_Cb)(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h);
EAPI void evas_common_rectangle_init (void);
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);
EAPI void evas_common_rectangle_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h);
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);

View File

@ -10,7 +10,7 @@ evas_common_rectangle_init(void)
}
EAPI void
evas_common_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h)
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)
{
static Cutout_Rects *rects = NULL;
Cutout_Rect *r;
@ -27,7 +27,7 @@ evas_common_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
/* no cutouts - cut right to the chase */
if (!dc->cutout.rects)
{
rectangle_draw_internal(dst, dc, x, y, w, h);
cb(dst, dc, x, y, w, h);
}
else
{
@ -40,7 +40,7 @@ evas_common_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
{
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);
cb(dst, dc, x, y, w, h);
}
}
}
@ -48,6 +48,12 @@ evas_common_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
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(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h)
{
evas_common_rectangle_draw_cb(dst, dc, x, y, w, h, rectangle_draw_internal);
}
EAPI Eina_Bool
evas_common_rectangle_draw_prepare(Cutout_Rects *reuse, const RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h)
{