On Wed, Nov 28, 2012 at 5:17 PM, Enlightenment SVN <no-re...@enlightenment.org> wrote: > > Log: > 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. >
This patch that saves clipper, apply cutouts and then call a function for every rectangle to actually do something is very common pattern in the engines. GL has it replicated, I recall I replicated this for 16bpp engine... We'll try to do more of those, then we can move engines to use this instead of similar codes as GL do. End goal is to dispatch all the small commands to a queue that the thread engine will consume and paint (the thread engine is under heavy dev, may hit the list in few days for further comments). > Signed-off-by: Paulo Alcantara <pca...@profusion.mobi> > > Patch by: Paulo Alcantara <pca...@profusion.mobi> > > > > Author: barbieri > Date: 2012-11-28 11:17:00 -0800 (Wed, 28 Nov 2012) > New Revision: 79785 > Trac: http://trac.enlightenment.org/e/changeset/79785 > > Modified: > trunk/efl/src/lib/evas/common/evas_rectangle.h > trunk/efl/src/lib/evas/common/evas_rectangle_main.c > > Modified: trunk/efl/src/lib/evas/common/evas_rectangle.h > =================================================================== > --- trunk/efl/src/lib/evas/common/evas_rectangle.h 2012-11-28 17:59:25 > UTC (rev 79784) > +++ trunk/efl/src/lib/evas/common/evas_rectangle.h 2012-11-28 19:17:00 > UTC (rev 79785) > @@ -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); > > Modified: trunk/efl/src/lib/evas/common/evas_rectangle_main.c > =================================================================== > --- trunk/efl/src/lib/evas/common/evas_rectangle_main.c 2012-11-28 17:59:25 > UTC (rev 79784) > +++ trunk/efl/src/lib/evas/common/evas_rectangle_main.c 2012-11-28 19:17:00 > UTC (rev 79785) > @@ -10,7 +10,7 @@ > } > > 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 @@ > /* 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 @@ > { > 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 @@ > 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) > { > > > ------------------------------------------------------------------------------ > Keep yourself connected to Go Parallel: > INSIGHTS What's next for parallel hardware, programming and related areas? > Interviews and blogs by thought leaders keep you ahead of the curve. > http://goparallel.sourceforge.net > _______________________________________________ > enlightenment-svn mailing list > enlightenment-...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn -- Gustavo Sverzut Barbieri http://profusion.mobi embedded systems -------------------------------------- MSN: barbi...@gmail.com Skype: gsbarbieri Mobile: +55 (19) 9225-2202 ------------------------------------------------------------------------------ Keep yourself connected to Go Parallel: INSIGHTS What's next for parallel hardware, programming and related areas? Interviews and blogs by thought leaders keep you ahead of the curve. http://goparallel.sourceforge.net _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel