Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/modules/engines/xrender_x11 Modified Files: evas_engine.c evas_engine.h evas_engine_gradient.c evas_engine_image.c evas_engine_xrender.c Log Message: patches that i said were in - commit. (see my reply emails) also finish off a TODO item or 2 =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/engines/xrender_x11/evas_engine.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- evas_engine.c 31 May 2006 18:33:46 -0000 1.9 +++ evas_engine.c 7 Jun 2006 23:30:15 -0000 1.10 @@ -76,6 +76,8 @@ static void *eng_image_data_put(void *data, void *image, DATA32 *image_data); static void *eng_image_alpha_set(void *data, void *image, int has_alpha); static int eng_image_alpha_get(void *data, void *image); +static void *eng_image_border_set(void *data, void *image, int l, int r, int t, int b); +static void eng_image_border_get(void *data, void *image, int *l, int *r, int *t, int *b); static void eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth); static const char *eng_image_comment_get(void *data, void *image, char *key); static char *eng_image_format_get(void *data, void *image); @@ -657,6 +659,21 @@ return _xre_image_alpha_get((XR_Image *)image); } +static void * +eng_image_border_set(void *data, void *image, int l, int r, int t, int b) +{ + if (!image) return image; + _xre_image_border_set((XR_Image *)image, l, r, t, b); + return image; +} + +static void +eng_image_border_get(void *data, void *image, int *l, int *r, int *t, int *b) +{ + if (!image) return; + _xre_image_border_get((XR_Image *)image, l, r, t, b); +} + static void eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth) { @@ -793,6 +810,8 @@ ORD(image_data_put); ORD(image_alpha_set); ORD(image_alpha_get); + ORD(image_border_set); + ORD(image_border_get); ORD(image_draw); ORD(image_comment_get); ORD(image_format_get); =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/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 31 May 2006 18:33:46 -0000 1.3 +++ evas_engine.h 7 Jun 2006 23:30:15 -0000 1.4 @@ -55,6 +55,7 @@ Picture pic; unsigned char alpha : 1; unsigned char allocated : 1; + unsigned char bordered : 1; }; /* ximage support calls (ximage vs xshmimage, cache etc.) */ @@ -117,6 +118,8 @@ void _xre_image_data_put(XR_Image *im, void *data); void _xre_image_alpha_set(XR_Image *im, int alpha); int _xre_image_alpha_get(XR_Image *im); +void _xre_image_border_set(XR_Image *im, int l, int r, int t, int b); +void _xre_image_border_get(XR_Image *im, int *l, int *r, int *t, int *b); void _xre_image_surface_gen(XR_Image *im); void _xre_image_cache_set(int size); int _xre_image_cache_get(void); =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/engines/xrender_x11/evas_engine_gradient.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- evas_engine_gradient.c 11 May 2006 12:48:22 -0000 1.3 +++ evas_engine_gradient.c 7 Jun 2006 23:30:15 -0000 1.4 @@ -164,7 +164,7 @@ _xre_gradient_draw(Xrender_Surface *rs, RGBA_Draw_Context *dc, XR_Gradient *gr, int x, int y, int w, int h, double angle, int spread) { RGBA_Image *im; - int mul_use; + int mul_use; if ((w <= 0) || (h <= 0)) return; if (!rs || !dc || !gr) return; =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/engines/xrender_x11/evas_engine_image.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- evas_engine_image.c 31 May 2006 18:33:46 -0000 1.5 +++ evas_engine_image.c 7 Jun 2006 23:30:15 -0000 1.6 @@ -472,6 +472,29 @@ } void +_xre_image_border_set(XR_Image *im, int l, int r, int t, int b) +{ + if (!im) return; + _xre_image_surface_gen(im); + if (l < 1) l = 0; + if (r < 1) r = 0; + if (t < 1) t = 0; + if (b < 1) b = 0; + if (im->surface) + { + if (l | r | t | b) + im->surface->bordered = 1; + else + im->surface->bordered = 0; + } +} + +void +_xre_image_border_get(XR_Image *im, int *l, int *r, int *t, int *b) +{ +} + +void _xre_image_surface_gen(XR_Image *im) { void *data = NULL; =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/engines/xrender_x11/evas_engine_xrender.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- evas_engine_xrender.c 16 May 2006 07:53:47 -0000 1.11 +++ evas_engine_xrender.c 7 Jun 2006 23:30:15 -0000 1.12 @@ -336,18 +336,34 @@ _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) { Xrender_Surface *trs = NULL; - XTransform xf; + XTransform xf, id; XRenderPictureAttributes att; Picture mask; int r, g, b, a, op; - int sf; + int e; if ((sw <= 0) || (sh <= 0) || (w <= 0) || (h <= 0)) return; + e = 0; + if ((sw != w) || (sh != h)) + e = 1; + att.clip_mask = None; XRenderChangePicture(srs->xinf->disp, srs->pic, CPClipMask, &att); XRenderChangePicture(srs->xinf->disp, drs->pic, CPClipMask, &att); + id.matrix[0][0] = 1 << 16; + id.matrix[0][1] = 0; + id.matrix[0][2] = 0; + + id.matrix[1][0] = 0; + id.matrix[1][1] = 1 << 16; + id.matrix[1][2] = 0; + + id.matrix[2][0] = 0; + id.matrix[2][1] = 0; + id.matrix[2][2] = 1 << 16; + op = PictOpSrc; if (srs->alpha) op = PictOpOver; mask = None; @@ -367,86 +383,57 @@ srs->xinf->mul_b = b; srs->xinf->mul_a = a; _xr_render_surface_solid_rectangle_set(srs->xinf->mul, - r, - g, - b, - a, + r, g, b, a, 0, 0, 1, 1); } - att.component_alpha = 1; op = PictOpOver; mask = srs->xinf->mul->pic; - XRenderChangePicture(srs->xinf->disp, mask, CPComponentAlpha, &att); if ((r == g == b == 0xff) && (a != 0xff)) { + att.component_alpha = 0; + XRenderChangePicture(srs->xinf->disp, mask, CPComponentAlpha, &att); } else { - xf.matrix[0][0] = 1 << 16; - xf.matrix[0][1] = 0; - xf.matrix[0][2] = 0; - - xf.matrix[1][0] = 0; - xf.matrix[1][1] = 1 << 16; - xf.matrix[1][2] = 0; - - xf.matrix[2][0] = 0; - xf.matrix[2][1] = 0; - xf.matrix[2][2] = 1 << 16; if ((srs->alpha) || (a != 0xff)) - trs = _xr_render_surface_new(srs->xinf, sw + 1, sh + 1, -// trs = _xr_render_surface_new(srs->xinf, sw, sh, + trs = _xr_render_surface_new(srs->xinf, sw + e, sh + e, srs->xinf->fmt32, 1); else - trs = _xr_render_surface_new(srs->xinf, sw + 1, sh + 1, -// trs = _xr_render_surface_new(srs->xinf, sw, sh, + trs = _xr_render_surface_new(srs->xinf, sw + e, sh + e, srs->fmt, srs->alpha); - XRenderSetPictureTransform(srs->xinf->disp, srs->pic, &xf); + if (!trs) return; + + att.component_alpha = 1; + XRenderChangePicture(srs->xinf->disp, mask, CPComponentAlpha, &att); + XRenderSetPictureTransform(srs->xinf->disp, srs->pic, &id); XRenderComposite(srs->xinf->disp, PictOpSrc, srs->pic, mask, trs->pic, sx, sy, 0, 0, 0, 0, sw, sh); /* fill right and bottom pixel so interpolation works right */ - XRenderComposite(srs->xinf->disp, PictOpSrc, srs->pic, mask, - trs->pic, sx + sw, sy, 0, 0, sw, 0, 1, sh); - XRenderComposite(srs->xinf->disp, PictOpSrc, srs->pic, mask, - trs->pic, sx, sy + sh, 0, 0, 0, sh, sw + 1, 1); -// XRenderComposite(srs->xinf->disp, PictOpSrc, srs->pic, mask, -// trs->pic, sx + sw, sy + sh, 0, 0, sw, sh, 1, 1); - mask = 0; + if (e) + { + XRenderComposite(srs->xinf->disp, PictOpSrc, srs->pic, mask, + trs->pic, sx + sw - 1, sy, 0, 0, sw, 0, 1, sh); + XRenderComposite(srs->xinf->disp, PictOpSrc, srs->pic, mask, + trs->pic, sx, sy + sh - 1, 0, 0, 0, sh, sw, 1); + XRenderComposite(srs->xinf->disp, PictOpSrc, srs->pic, mask, + trs->pic, sx + sw - 1, sy + sh - 1, 0, 0, sw, sh, 1, 1); + } + mask = None; } } } -/* - sf = MAX(sw, sh); -#define BMAX 26 - if (sf <= 8 ) sf = 1 << (BMAX - 3); - else if (sf <= 16 ) sf = 1 << (BMAX - 4); - else if (sf <= 32 ) sf = 1 << (BMAX - 5); - else if (sf <= 64 ) sf = 1 << (BMAX - 6); - else if (sf <= 128 ) sf = 1 << (BMAX - 7); - else if (sf <= 256 ) sf = 1 << (BMAX - 8); - else if (sf <= 512 ) sf = 1 << (BMAX - 9); - else if (sf <= 1024 ) sf = 1 << (BMAX - 10); - else if (sf <= 2048 ) sf = 1 << (BMAX - 11); - else if (sf <= 4096 ) sf = 1 << (BMAX - 12); - else if (sf <= 8192 ) sf = 1 << (BMAX - 13); - else if (sf <= 16384) sf = 1 << (BMAX - 14); - else sf = 1 << (BMAX - 15); -*/ - -// xf.matrix[0][0] = (sf * sw) / w; + xf.matrix[0][0] = (sw << 16) / w; xf.matrix[0][1] = 0; xf.matrix[0][2] = 0; xf.matrix[1][0] = 0; -// xf.matrix[1][1] = (sf * sh) / h; xf.matrix[1][1] = (sh << 16) / h; xf.matrix[1][2] = 0; xf.matrix[2][0] = 0; xf.matrix[2][1] = 0; xf.matrix[2][2] = 1 << 16; -// xf.matrix[2][2] = sf; _xr_render_surface_clips_set(drs, dc, x, y, w, h); if (trs) @@ -463,18 +450,45 @@ } else { - if (smooth) - XRenderSetPictureFilter(srs->xinf->disp, srs->pic, "best", NULL, 0); - else - XRenderSetPictureFilter(srs->xinf->disp, srs->pic, "nearest", NULL, 0); - XRenderSetPictureTransform(srs->xinf->disp, srs->pic, &xf); - - XRenderComposite(srs->xinf->disp, op, srs->pic, mask, drs->pic, -// (sx * w) / sw, -// (sy * h) / sh, - ((sx * w) + (sw / 2)) / sw, - ((sy * h) + (sh / 2)) / sh, - 0, 0, x, y, w, h); + if (srs->bordered && e) + { + trs = _xr_render_surface_new(srs->xinf, sw + 1, sh + 1, + srs->fmt, srs->alpha); + if (!trs) return; + + XRenderSetPictureTransform(srs->xinf->disp, srs->pic, &id); + XRenderComposite(srs->xinf->disp, PictOpSrc, srs->pic, None, + trs->pic, sx, sy, 0, 0, 0, 0, sw, sh); + XRenderComposite(srs->xinf->disp, PictOpSrc, srs->pic, None, + trs->pic, sx + sw - 1, sy, 0, 0, sw, 0, 1, sh); + XRenderComposite(srs->xinf->disp, PictOpSrc, srs->pic, None, + trs->pic, sx, sy + sh - 1, 0, 0, 0, sh, sw, 1); + XRenderComposite(srs->xinf->disp, PictOpSrc, srs->pic, None, + trs->pic, sx + sw - 1, sy + sh - 1, 0, 0, sw, sh, 1, 1); + + if (smooth) + XRenderSetPictureFilter(trs->xinf->disp, trs->pic, "best", NULL, 0); + else + XRenderSetPictureFilter(trs->xinf->disp, trs->pic, "nearest", NULL, 0); + + XRenderSetPictureTransform(trs->xinf->disp, trs->pic, &xf); + XRenderComposite(trs->xinf->disp, op, trs->pic, mask, drs->pic, + 0, 0, 0, 0, x, y, w, h); + _xr_render_surface_free(trs); + } + else + { + if (smooth) + XRenderSetPictureFilter(srs->xinf->disp, srs->pic, "best", NULL, 0); + else + XRenderSetPictureFilter(srs->xinf->disp, srs->pic, "nearest", NULL, 0); + + XRenderSetPictureTransform(srs->xinf->disp, srs->pic, &xf); + XRenderComposite(srs->xinf->disp, op, srs->pic, mask, drs->pic, + ((sx * w) + (sw / 2)) / sw, + ((sy * h) + (sh / 2)) / sh, + 0, 0, x, y, w, h); + } } } _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs