in theory support dest alpha

SVN revision: 17120
This commit is contained in:
Carsten Haitzler 2005-10-03 03:34:21 +00:00
parent 8bf5f10e92
commit 62d1bb0190
5 changed files with 69 additions and 7 deletions

View File

@ -18,7 +18,7 @@ sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
# if CDPATH is set.
if test "${CDPATH+set}" = set; then CDPATH=:; export CDPATH; fi
relink_command="(cd /home/raster/C/evas/src/bin; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; PATH=\"/home/raster/bin:/home/raster/s:/usr/local/bin:/usr/local/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/games:/sbin:/usr/sbin:/usr/X11R6/lib/xscreensaver:/opt/arm/3.3.2-vfp/bin:/opt/bitkeeper:/opt/java.sun/java.current/bin:.:\"; export PATH; ccache gcc -O2 -march=pentium4 -g -msse -mmmx -pipe -o \$progdir/\$file evas_test_main.o evas_xrender_x11_main.o ../../src/lib/.libs/libevas.so -lm -L/usr/X11R6/lib -lX11 -lXext /usr/lib/libXrender.so -Wl,--rpath -Wl,/home/raster/C/evas/src/lib/.libs)"
relink_command="(cd /home/raster/C/evas/src/bin; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; PATH=\"/home/raster/bin:/home/raster/s:/usr/local/bin:/usr/local/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/games:/sbin:/usr/sbin:/usr/X11R6/lib/xscreensaver:/opt/arm/3.3.2-vfp/bin:/opt/bitkeeper:/opt/java.sun/java.current/bin:.:\"; export PATH; ccache gcc -O2 -march=pentium4 -g -msse -mmmx -pipe -o \$progdir/\$file evas_xrender_x11_test-evas_test_main.o evas_xrender_x11_test-evas_xrender_x11_main.o ../../src/lib/.libs/libevas.so -lm -L/usr/X11R6/lib -lX11 -lXext /usr/lib/libXrender.so -Wl,--rpath -Wl,/home/raster/C/evas/src/lib/.libs)"
# This environment variable determines our operation mode.
if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then

View File

@ -13,10 +13,11 @@ struct _Evas_Engine_Info_XRender_X11
/* engine specific data & parameters it needs to set up */
struct {
Display *display;
Drawable drawable;
Pixmap mask;
Visual *visual;
Display *display;
Drawable drawable;
Pixmap mask;
Visual *visual;
unsigned char destination_alpha : 1;
} info;
/* engine specific function calls to query stuff about the destination */
/* engine (what visual & colormap & depth to use, performance info etc. */

View File

@ -86,9 +86,11 @@ struct _Render_Engine
Visual *vis;
Drawable win;
Pixmap mask;
unsigned char destination_alpha : 1;
Ximage_Info *xinf;
Xrender_Surface *output;
Xrender_Surface *mask_output;
Tilebuf *tb;
Tilebuf_Rect *rects;
@ -238,11 +240,18 @@ evas_engine_xrender_x11_setup(Evas *e, void *in)
re->vis = info->info.visual;
re->win = info->info.drawable;
re->mask = info->info.mask;
re->destination_alpha = info->info.destination_alpha;
if (re->xinf) _xr_image_info_free(re->xinf);
re->xinf = _xr_image_info_get(re->disp, re->win, re->vis);
if (re->output) _xr_render_surface_free(re->output);
re->output = _xr_render_surface_adopt(re->xinf, re->win, e->output.w, e->output.h, 0);
if (re->mask)
{
if (re->mask_output) _xr_render_surface_free(re->mask_output);
re->mask_output = _xr_render_surface_format_adopt(re->xinf, re->win, e->output.w, e->output.h, re->xinf->fmt1, 1);
}
}
static void
@ -256,6 +265,7 @@ evas_engine_xrender_x11_output_free(void *data)
if (re->xinf) _xr_image_info_free(re->xinf);
if (re->tb) evas_common_tilebuf_free(re->tb);
if (re->output) _xr_render_surface_free(re->output);
if (re->mask_output) _xr_render_surface_free(re->mask_output);
if (re->rects) evas_common_tilebuf_free_render_rects(re->rects);
free(re);
}
@ -272,6 +282,11 @@ evas_engine_xrender_x11_output_resize(void *data, int w, int h)
if (re->output) _xr_render_surface_free(re->output);
}
re->output = _xr_render_surface_adopt(re->xinf, re->win, w, h, 0);
if (re->mask_output)
{
if (re->mask_output) _xr_render_surface_free(re->mask_output);
re->mask_output = _xr_render_surface_format_adopt(re->xinf, re->win, w, h, re->xinf->fmt1, 1);
}
evas_common_tilebuf_free(re->tb);
re->tb = evas_common_tilebuf_new(w, h);
if (re->tb) evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
@ -344,6 +359,8 @@ evas_engine_xrender_x11_output_redraws_next_update_get(void *data, int *x, int *
*x = ux; *y = uy; *w = uw; *h = uh;
*cx = 0; *cy = 0; *cw = uw; *ch = uh;
if ((re->destination_alpha)|| (re->mask))
return _xr_render_surface_new(re->xinf, uw, uh, re->xinf->fmt32, 1);
return _xr_render_surface_new(re->xinf, uw, uh, re->xinf->fmt24, 0);
}
@ -353,8 +370,27 @@ evas_engine_xrender_x11_output_redraws_next_update_push(void *data, void *surfac
Render_Engine *re;
re = (Render_Engine *)data;
_xr_render_surface_copy((Xrender_Surface *)surface, re->output, 0, 0,
x, y, w, h);
if (re->mask_output)
{
Xrender_Surface *tsurf;
_xr_render_surface_copy((Xrender_Surface *)surface, re->output, 0, 0,
x, y, w, h);
tsurf = _xr_render_surface_new(re->xinf, w, h, re->xinf->fmt1, 1);
if (tsurf)
{
_xr_render_surface_copy((Xrender_Surface *)surface, tsurf, 0, 0,
0, 0, w, h);
_xr_render_surface_copy(tsurf, re->mask_output, 0, 0,
x, y, w, h);
_xr_render_surface_free(tsurf);
}
}
else
{
_xr_render_surface_copy((Xrender_Surface *)surface, re->output, 0, 0,
x, y, w, h);
}
_xr_render_surface_free((Xrender_Surface *)surface);
}

View File

@ -68,6 +68,7 @@ void _xr_image_put(Ximage_Image *xim, Drawable draw, int x, int y, int
/* xrender support calls */
Xrender_Surface *_xr_render_surface_new(Ximage_Info *xinf, int w, int h, XRenderPictFormat *fmt, int alpha);
Xrender_Surface *_xr_render_surface_adopt(Ximage_Info *xinf, Drawable draw, int w, int h, int alpha);
Xrender_Surface *_xr_render_surface_format_adopt(Ximage_Info *xinf, Drawable draw, int w, int h, XRenderPictFormat *fmt, int alpha);
void _xr_render_surface_free(Xrender_Surface *rs);
void _xr_render_surface_repeat_set(Xrender_Surface *rs, int repeat);
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);

View File

@ -42,6 +42,30 @@ _xr_render_surface_adopt(Ximage_Info *xinf, Drawable draw, int w, int h, int alp
rs->fmt = fmt;
rs->alpha = alpha;
rs->depth = fmt->depth;
if (fmt->depth == 32) rs->alpha = 1;
rs->allocated = 0;
rs->draw = draw;
att.dither = 1;
att.component_alpha = 1;
att.repeat = 0;
rs->pic = XRenderCreatePicture(xinf->disp, rs->draw, fmt, CPRepeat | CPDither | CPComponentAlpha, &att);
return rs;
}
Xrender_Surface *
_xr_render_surface_format_adopt(Ximage_Info *xinf, Drawable draw, int w, int h, XRenderPictFormat *fmt, int alpha)
{
Xrender_Surface *rs;
XRenderPictureAttributes att;
rs = calloc(1, sizeof(Xrender_Surface));
rs->xinf = xinf;
rs->w = w;
rs->h = h;
rs->fmt = fmt;
rs->alpha = alpha;
rs->depth = fmt->depth;
if (fmt->depth == 32) rs->alpha = 1;
rs->allocated = 0;
rs->draw = draw;
att.dither = 1;