Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/evas
Dir : e17/libs/evas/src/lib/engines/xrender_x11
Modified Files:
evas_engine.c evas_engine.h evas_engine_xrender.c
Log Message:
support clipouts in xrender engine
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/xrender_x11/evas_engine.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- evas_engine.c 6 Oct 2005 02:38:34 -0000 1.7
+++ evas_engine.c 8 Oct 2005 04:57:57 -0000 1.8
@@ -521,23 +521,19 @@
static void
evas_engine_xrender_x11_context_cutout_add(void *data, void *context, int x,
int y, int w, int h)
{
-/*
Render_Engine *re;
re = (Render_Engine *)data;
evas_common_draw_context_add_cutout(context, x, y, w, h);
- */
}
static void
evas_engine_xrender_x11_context_cutout_clear(void *data, void *context)
{
-/*
Render_Engine *re;
re = (Render_Engine *)data;
evas_common_draw_context_clear_cutouts(context);
- */
}
@@ -1056,6 +1052,7 @@
}
im->image->w = ((Xrender_Surface *)surface)->w;
im->image->h = ((Xrender_Surface *)surface)->h;
+ _xr_render_surface_clips_set((Xrender_Surface *)surface,
(RGBA_Draw_Context *)context, x, y, w, h);
im->image->data = surface;
evas_common_draw_context_font_ext_set(context,
re->xinf,
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/xrender_x11/evas_engine.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- evas_engine.h 6 Oct 2005 02:38:34 -0000 1.3
+++ evas_engine.h 8 Oct 2005 04:57:57 -0000 1.4
@@ -74,6 +74,7 @@
void _xr_render_surface_solid_rectangle_set(Xrender_Surface *rs,
int r, int g, int b, int a, int x, int y, int w, int h);
void _xr_render_surface_argb_pixels_fill(Xrender_Surface *rs, int
sw, int sh, void *pixels, int x, int y, int w, int h);
void _xr_render_surface_rgb_pixels_fill(Xrender_Surface *rs, int
sw, int sh, void *pixels, int x, int y, int w, int h);
+void _xr_render_surface_clips_set(Xrender_Surface *rs,
RGBA_Draw_Context *dc, int rx, int ry, int rw, int rh);
void _xr_render_surface_composite(Xrender_Surface *srs,
Xrender_Surface *drs, RGBA_Draw_Context *dc, int sx, int sy, int sw, int sh,
int x, int y, int w, int h, int smooth);
void _xr_render_surface_copy(Xrender_Surface *srs, Xrender_Surface
*drs, int sx, int sy, int x, int y, int w, int h);
void _xr_render_surface_rectangle_draw(Xrender_Surface *rs,
RGBA_Draw_Context *dc, int x, int y, int w, int h);
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/xrender_x11/evas_engine_xrender.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- evas_engine_xrender.c 6 Oct 2005 09:53:10 -0000 1.5
+++ evas_engine_xrender.c 8 Oct 2005 04:57:57 -0000 1.6
@@ -3,6 +3,7 @@
#include "evas_engine.h"
#include "evas_engine_api_xrender_x11.h"
#include "Evas_Engine_XRender_X11.h"
+#include <math.h>
Xrender_Surface *
_xr_render_surface_new(Ximage_Info *xinf, int w, int h, XRenderPictFormat
*fmt, int alpha)
@@ -224,14 +225,58 @@
_xr_image_put(xim, rs->draw, x, y, w, h);
}
+void
+_xr_render_surface_clips_set(Xrender_Surface *rs, RGBA_Draw_Context *dc, int
rx, int ry, int rw, int rh)
+{
+ int num = 0;
+ XRectangle *rect = NULL;
+
+ if ((dc) && (dc->clip.use))
+ {
+ RECTS_CLIP_TO_RECT(rx, ry, rw, rh,
+ dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);
+ }
+ if ((!dc) || (!dc->cutout.rects))
+ {
+ rect = malloc(sizeof(XRectangle));
+ if (!rect) return;
+ rect->x = rx;
+ rect->y = ry;
+ rect->width = rw;
+ rect->height = rh;
+ num = 1;
+ }
+ else
+ {
+ int i;
+ Cutout_Rect *rects, *r;
+ Evas_Object_List *l;
+
+ rects = evas_common_draw_context_apply_cutouts(dc);
+ for (num = 0, l = (Evas_Object_List *)rects; l; l = l->next) num++;
+ rect = malloc(num * sizeof(XRectangle));
+ if (!rect) return;
+ for (i = 0, l = (Evas_Object_List *)rects; l; l = l->next, i++)
+ {
+ r = (Cutout_Rect *)l;
+ rect[i].x = r->x;
+ rect[i].y = r->y;
+ rect[i].width = r->w;
+ rect[i].height = r->h;
+ }
+ evas_common_draw_context_apply_free_cutouts(rects);
+ }
+ if (!rect) return;
+ XRenderSetPictureClipRectangles(rs->xinf->disp, rs->pic, 0, 0, rect, num);
+ free(rect);
+}
+
// when color multiplier is used want: instead
-// CA src IN mask SRC temp; non-CA temp OVER dst.
-//
+// CA src IN mask SRC temp; non-CA temp OVER dst. - i think. need to check.
void
_xr_render_surface_composite(Xrender_Surface *srs, Xrender_Surface *drs,
RGBA_Draw_Context *dc, int sx, int sy, int sw, int sh, int x, int y, int w, int
h, int smooth)
{
XTransform xf;
- XRectangle rect;
XRenderPictureAttributes att;
Picture mask;
int r, g, b, a, op;
@@ -278,17 +323,11 @@
att.clip_mask = None;
XRenderChangePicture(srs->xinf->disp, srs->pic, CPClipMask, &att);
XRenderChangePicture(srs->xinf->disp, drs->pic, CPClipMask, &att);
- rect.x = x; rect.y = y; rect.width = w; rect.height = h;
- if ((dc) && (dc->clip.use))
- {
- RECTS_CLIP_TO_RECT(rect.x, rect.y, rect.width, rect.height,
- dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);
- }
if (smooth) XRenderSetPictureFilter(srs->xinf->disp, srs->pic, "bilinear",
NULL, 0);
else XRenderSetPictureFilter(srs->xinf->disp, srs->pic, "nearest", NULL, 0);
- XRenderSetPictureClipRectangles(srs->xinf->disp, drs->pic, 0, 0, &rect, 1);
+ _xr_render_surface_clips_set(drs, dc, x, y, w, h);
XRenderComposite(srs->xinf->disp, op, srs->pic, mask, drs->pic,
((sx * w) + (sw / 2)) / sw,
((sy * h) + (sh / 2)) / sh,
@@ -328,7 +367,6 @@
_xr_render_surface_rectangle_draw(Xrender_Surface *rs, RGBA_Draw_Context *dc,
int x, int y, int w, int h)
{
XRenderColor col;
- XRectangle rect;
XRenderPictureAttributes att;
int r, g, b, a, aa, op;
@@ -350,31 +388,22 @@
if (a < 0xff) op = PictOpOver;
att.clip_mask = None;
XRenderChangePicture(rs->xinf->disp, rs->pic, CPClipMask, &att);
- if ((dc) && (dc->clip.use))
- {
- rect.x = dc->clip.x; rect.y = dc->clip.y;
- rect.width = dc->clip.w; rect.height = dc->clip.h;
- XRenderSetPictureClipRectangles(rs->xinf->disp, rs->pic, 0, 0, &rect,
1);
- }
+
+ _xr_render_surface_clips_set(rs, dc, x, y, w, h);
XRenderFillRectangle(rs->xinf->disp, op, rs->pic, &col, x, y, w, h);
}
void
_xr_render_surface_line_draw(Xrender_Surface *rs, RGBA_Draw_Context *dc, int
x1, int y1, int x2, int y2)
{
- XRectangle rect;
XRenderPictureAttributes att;
int op;
op = PictOpSrc;
att.clip_mask = None;
XRenderChangePicture(rs->xinf->disp, rs->pic, CPClipMask, &att);
- if ((dc) && (dc->clip.use))
- {
- rect.x = dc->clip.x; rect.y = dc->clip.y;
- rect.width = dc->clip.w; rect.height = dc->clip.h;
- XRenderSetPictureClipRectangles(rs->xinf->disp, rs->pic, 0, 0, &rect,
1);
- }
+ _xr_render_surface_clips_set(rs, dc, 0, 0, rs->w, rs->h);
+
{
int r, g, b, a;
XPointDouble poly[4];
@@ -383,7 +412,7 @@
dx = x2 - x1;
dy = y2 - y1;
- len = sqrt((dx * dx) + (dy * dy));
+ len = sqrt((double)(dx * dx) + (double)(dy * dy));
ddx = (0.5 * dx) / len;
ddy = (0.5 * dy) / len;
poly[0].x = (x1 + ddx);
@@ -424,7 +453,6 @@
int i, num;
XPointDouble *pts;
int r, g, b, a;
- XRectangle rect;
XRenderPictureAttributes att;
int op;
@@ -459,15 +487,10 @@
i++;
}
}
- rect.x = 0; rect.y = 0; rect.width = rs->w; rect.height = rs->h;
att.clip_mask = None;
XRenderChangePicture(rs->xinf->disp, rs->pic, CPClipMask, &att);
- if ((dc) && (dc->clip.use))
- {
- RECTS_CLIP_TO_RECT(rect.x, rect.y, rect.width, rect.height,
- dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);
- }
- XRenderSetPictureClipRectangles(rs->xinf->disp, rs->pic, 0, 0, &rect, 1);
+
+ _xr_render_surface_clips_set(rs, dc, 0, 0, rs->w, rs->h);
XRenderCompositeDoublePoly(rs->xinf->disp, op,
rs->xinf->mul->pic, rs->pic,
rs->xinf->fmt8, 0, 0, 0, 0,
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs