Enlightenment CVS committal
Author : turran
Project : e17
Module : proto/enesim
Dir : e17/proto/enesim/src/lib/raster/renderer
Modified Files:
fill_surface.c
Log Message:
- renderer fill surface now has a src and dst rectangle
- general function to create a rectangle from its coordinates
===================================================================
RCS file: /cvs/e/e17/proto/enesim/src/lib/raster/renderer/fill_surface.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- fill_surface.c 14 Oct 2007 17:49:29 -0000 1.2
+++ fill_surface.c 19 Oct 2007 16:21:07 -0000 1.3
@@ -12,18 +12,19 @@
*============================================================================*/
typedef struct _Fill_Surface
{
- Enesim_Surface *s;
- int mode;
- Enesim_Rectangle area;
+ Enesim_Surface *s;
+ int mode;
+ Enesim_Rectangle sarea;
+ Enesim_Rectangle darea;
} Fill_Surface;
-static inline void _draw_alias(Enesim_Renderer *r, Scanline_Alias *sl,
Enesim_Surface *dst)
-{
- Fill_Surface *f;
- int off;
- f = r->data;
+static inline void _draw_alias_sl(Fill_Surface *f, Scanline_Alias_Sl *sl,
Enesim_Surface *dst)
+{
+ int offset;
+#define DRECT f->darea
+#define SRECT f->sarea
/*
* +---+---+ +---+---+
* | S | S | | S | |
@@ -34,7 +35,13 @@
if (!(f->mode & ENESIM_SURFACE_REPEAT_Y))
{
/* scanline outside vertical area */
+ if (sl->y > DRECT.y + SRECT.h - 1)
+ {
+ // FIXME fill base color ?
+ return;
+ }
/* scanline inside vertical area */
+ offset = ((sl->y - DRECT.y) + SRECT.y) * f->s->w + SRECT.x;
}
/*
* +---+---+ +---+---+
@@ -46,6 +53,7 @@
else
{
/* scanline inside vertical area */
+ offset = (((sl->y - DRECT.y) % SRECT.h) + SRECT.y) * f->s->w +
SRECT.x;
}
/*
* +---+---+ +---+---+
@@ -77,6 +85,24 @@
}
}
+static inline void _draw_alias(Enesim_Renderer *r, Scanline_Alias *sl,
Enesim_Surface *dst)
+{
+ Fill_Surface *f;
+ Scanline_Alias_Sl *s;
+ int nsl;
+ int i;
+
+ f = r->data;
+ nsl = sl->num_sls;
+ s = sl->sls;
+
+ for (i = 0; i < nsl; i++)
+ {
+ _draw_alias_sl(f, s, dst);
+ s++;
+ }
+}
+
static void _draw(Enesim_Renderer *r, Enesim_Scanline *sl, Enesim_Surface *dst)
{
_draw_alias(r, sl->data, dst);
@@ -140,14 +166,29 @@
* To be documented
* FIXME: To be fixed
*/
-EAPI void enesim_fill_surface_area_set(Enesim_Renderer *r, int x, int y, int
w, int h)
+EAPI void enesim_fill_surface_dst_area_set(Enesim_Renderer *r, int x, int y,
int w, int h)
{
- Fill_Surface *f;
+ Fill_Surface *f;
+ assert(r);
+ x = (x < 0) ? 0 : x;
+ y = (y < 0) ? 0 : y;
+ w = (w < 0) ? 0 : w;
+ h = (h < 0) ? 0 : h;
+ enesim_rectangle_from_coords(&f->darea, x, y, w, h);
+}
+/**
+ * To be documented
+ * FIXME: To be fixed
+ */
+EAPI void enesim_fill_surface_src_area_set(Enesim_Renderer *r, int x, int y,
int w, int h)
+{
+ Fill_Surface *f;
assert(r);
- f = r->data;
- f->area.x = (x < 0) ? 0 : x;
- f->area.y = (y < 0) ? 0 : y;
- f->area.w = (w < 0) ? 0 : w;
- f->area.h = (h < 0) ? 0 : h;
+
+ x = (x < 0) ? 0 : x;
+ y = (y < 0) ? 0 : y;
+ w = (w < 0) ? 0 : w;
+ h = (h < 0) ? 0 : h;
+ enesim_rectangle_from_coords(&f->sarea, x, y, w, h);
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs